Hello Everybody,

I have run into a bit of a trouble here
I wish to set the background image of a button
I have written this XAML

                <ImageBrush ImageSource="/UIDesign;component/Images/Settings.png" />

but when i run the application and hover the mouse over the button, the background goes away and default button background comes in. I wish it to stay even when i hover the mouse

Am i missing something really obvious?
How do i do this?

Please help


You need to modify the control template to override the default mouseover and click triggers. Here is a sample:

<Style x:Key="BorderlessButton" TargetType="{x:Type Button}">
            <Setter Property="Padding" Value="1"/>
            <Setter Property="Template">
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border Name="border" Background="{TemplateBinding Background}">
                            <ContentPresenter Name="content" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                              Margin="{TemplateBinding Padding}" 
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="content" Property="RenderTransform" >
                                        <ScaleTransform ScaleX="1.1" ScaleY="1.1" />
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Background">
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1" >
                                            <GradientStop Color="LightGray" Offset="0.35"/>
                                            <GradientStop Color="Gray" Offset="0.95"/>
                                            <GradientStop Color="LightGray" Offset="1"/>
                                <Setter TargetName="content" Property="RenderTransform" >
                                        <ScaleTransform ScaleX=".95" ScaleY=".95" />
                            <Trigger Property="IsFocused" Value="True">
This article has been dead for over six months. Start a new discussion instead.