Hi,
Thanks for your help.
I just want create a button Start/Stop with 2 differents images in background, one to Start and one to Stop.
Actually, I have a ressource dictionnary with differents images. These images are SVG file conversion.
I have a ressource dictionnary for styles. For my buttons:
<pre lang="xml">
!-- Controle Button -->
<style x:key="CtrlButton" targettype="{x:Type Button}" xmlns:x="#unknown">
<setter property="Template">
<setter.value>
<controltemplate targettype="{x:Type Button}">
<border x:name="ButtonBorder">
CornerRadius="10,10,10,10"
BorderThickness="0,0,0,0"
BorderBrush="#FF8F8F8F"
RenderTransformOrigin="0.5,0.5"
Background="{TemplateBinding Background}"
>
<contentpresenter x:name="ButtonContentPresenter">
VerticalAlignment="Bottom"
HorizontalAlignment="Center"
/>
</contentpresenter></border>
<controltemplate.triggers>
<trigger property="IsPressed" value="True">
<setter property="RenderTransform" targetname="ButtonBorder">
<setter.value>
<transformgroup>
<scaletransform scalex="0.9" scaley="0.9" />
</transformgroup>
</setter.value>
</setter>
</trigger>
</controltemplate.triggers>
</controltemplate>
</setter.value>
</setter>
</style>
And in my Xaml code :
<button style="{StaticResource CtrlButton}" name="btnStart" height="64" width="64" margin="50,20,10,0" click="btnStart_Click">
<button.background>
<visualbrush visual="{StaticResource Play}" stretch="Uniform">
</visualbrush>
</button.background>
</button>
With your code example, the image change only the mouse is over the button?
For my problem, i thought it was necessary to change the background image only by code. I would look in the xaml example code.