Skip to content

Instantly share code, notes, and snippets.

@glebd
Created May 25, 2010 10:39
Show Gist options
  • Save glebd/412992 to your computer and use it in GitHub Desktop.
Save glebd/412992 to your computer and use it in GitHub Desktop.
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="innerBorder">
<!-- Use one JPEG image as the background of ToggleButton -->
<Border.Background>
<ImageBrush ImageSource="C:\Users\Public\Pictures\Sample Pictures\Tree.jpg" />
</Border.Background>
</Border>
<ControlTemplate.Triggers>
<!-- Change the background image to Dock.jpg when the IsChecked property is True ,
Otherwise, it will automatically switch to original background image -->
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="innerBorder" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="C:\Users\Public\Pictures\Sample Pictures\Dock.jpg" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment