Click here to Skip to main content
15,662,484 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am using a simple button in WPF.
I have put an image for the button on background. My problem is, when i move mouse pointer to button it get a default glow and override the image given as background.
I need to retain the button as it.

<Button Grid.Column="3" Name="Play" BorderBrush="Transparent" Focusable="False" Width="45" Height="45" Click="Play_Click" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,6,10,6">
   <Button.Background >
       <ImageBrush ImageSource="images/play.png"  />

You can Apply this style to your "Play" button..

<Style x:Key="ButtonStyleNoHighlighting" TargetType="Button">
        <Setter Property="Template">
                <ControlTemplate TargetType="Button">
                    <Grid Background="{TemplateBinding Background}">
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>

Hope this will help you
Share this answer
Sarin VT 8-Aug-13 5:42am    
Thank you Punam. :)
Its working.
Joezer BH 8-Aug-13 5:45am    
ridoy 8-Aug-13 5:51am    
good one,+5.
Laurent Chougrani 18-Jun-18 13:24pm    
You should add :

<Label Content="{TemplateBinding Content}">

after the <visualstatemanager.visualstategroups>, so that your content shows.
If someone doesn't want to override default Control Template then here is the solution.

You can create DataTemplate for button which can have TextBlock and then you can write Property trigger on IsMouseOver property to disable mouse over effect. Height of TextBlock and Button should be same.

        <Button Background="Black" Margin="0" Padding="0" BorderThickness="0" Cursor="Hand" Height="20">
                                <TextBlock Text="GO" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" TextDecorations="Underline" Margin="0" Padding="0" Height="20">
                                        <Style TargetType="TextBlock">
                                                <Trigger Property ="IsMouseOver" Value="True">
                                                    <Setter Property= "Background" Value="Black"/>
Share this answer
Another really quick and dirty workaround to disable glowing is to set
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900