J'ai le code ci-dessous qui est censé changer l'image lorsque le ToggleButton est activé, mais malheureusement il ne fait rien. Des idées?Utiliser ObjectAnimation pour changer l'image de ToggleButton en fonction de CheckState
<Style x:Key="CustomButton" TargetType="ToggleButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid>
<Ellipse HorizontalAlignment="Stretch" VerticalAlignment="Stretch" x:Name="CheckedImage" Visibility="Collapsed" >
<Ellipse.Fill>
<ImageBrush ImageSource="Checked.png" Stretch="UniformToFill"></ImageBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse HorizontalAlignment="Stretch" VerticalAlignment="Stretch" x:Name="UnCheckedImage" Visibility="Collapsed">
<Ellipse.Fill>
<ImageBrush ImageSource="UnChecked.png" Stretch="UniformToFill"></ImageBrush>
</Ellipse.Fill>
</Ellipse>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CheckStates">
<VisualState x:Name="Checked">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckedImage" Storyboard.TargetProperty="Visibility" Duration="0">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="UnChecked">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="UnCheckedImage" Storyboard.TargetProperty="Visibility" Duration="0">
<DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Cursor" Value="Hand" />
</Style>