ToggleButton.xaml 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <!-- Design Token for subtool -->
  3. <Style x:Key="subToobar" TargetType="{x:Type ToggleButton}">
  4. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  5. <Setter Property="Background" Value="Transparent" />
  6. <Setter Property="BorderThickness" Value="0" />
  7. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
  8. <Setter Property="Template">
  9. <Setter.Value>
  10. <ControlTemplate TargetType="{x:Type ToggleButton}">
  11. <Border
  12. x:Name="border"
  13. Background="{TemplateBinding Panel.Background}"
  14. BorderBrush="{TemplateBinding Border.BorderBrush}"
  15. BorderThickness="{TemplateBinding Border.BorderThickness}"
  16. CornerRadius="{StaticResource border-radius.4}"
  17. SnapsToDevicePixels="True">
  18. <ContentPresenter
  19. x:Name="contentPresenter"
  20. Margin="{TemplateBinding Padding}"
  21. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  22. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  23. Content="{TemplateBinding Content}"
  24. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  25. ContentTemplate="{TemplateBinding ContentTemplate}"
  26. Focusable="False"
  27. RecognizesAccessKey="True"
  28. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  29. </Border>
  30. <ControlTemplate.Triggers>
  31. <Trigger Property="IsMouseOver" Value="True">
  32. <Setter TargetName="border" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv2}" />
  33. </Trigger>
  34. <Trigger Property="IsPressed" Value="True">
  35. <Setter TargetName="border" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv2}" />
  36. </Trigger>
  37. <Trigger Property="IsChecked" Value="True">
  38. <Setter TargetName="border" Property="Panel.Background" Value="{StaticResource color.item-state.sel.bg.lv2}" />
  39. </Trigger>
  40. <Trigger Property="IsEnabled" Value="False">
  41. <Setter TargetName="border" Property="Panel.Background" Value="Transparent" />
  42. <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.dis}" />
  43. </Trigger>
  44. </ControlTemplate.Triggers>
  45. </ControlTemplate>
  46. </Setter.Value>
  47. </Setter>
  48. </Style>
  49. </ResourceDictionary>