ToggleBlock.xaml 1.6 KB

123456789101112131415161718192021222324
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:hc="clr-namespace:HandyControl.Controls">
  4. <Style BasedOn="{StaticResource ToggleBlockBaseStyle}" TargetType="hc:ToggleBlock"/>
  5. <Style x:Key="ToggleBlockIcon" BasedOn="{StaticResource ToggleBlockBaseStyle}" TargetType="hc:ToggleBlock">
  6. <Setter Property="Template">
  7. <Setter.Value>
  8. <ControlTemplate TargetType="hc:ToggleBlock">
  9. <ContentControl Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
  10. <Path x:Name="PathIcon" Width="{TemplateBinding hc:IconElement.Width}" Height="{TemplateBinding hc:IconElement.Height}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconSwitchElement.Geometry}"/>
  11. </ContentControl>
  12. <ControlTemplate.Triggers>
  13. <Trigger Property="IsChecked" Value="True">
  14. <Setter TargetName="PathIcon" Property="Data" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(hc:IconSwitchElement.GeometrySelected)}"/>
  15. </Trigger>
  16. </ControlTemplate.Triggers>
  17. </ControlTemplate>
  18. </Setter.Value>
  19. </Setter>
  20. </Style>
  21. </ResourceDictionary>