ComboxItemStyle.xaml 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <ControlTemplate x:Key="comboxitem" TargetType="{x:Type ComboBoxItem}">
  3. <Border
  4. Name="Bd"
  5. Padding="{TemplateBinding Control.Padding}"
  6. Background="{TemplateBinding Panel.Background}"
  7. BorderBrush="{TemplateBinding Border.BorderBrush}"
  8. BorderThickness="{TemplateBinding Border.BorderThickness}"
  9. SnapsToDevicePixels="True">
  10. <ContentPresenter
  11. HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
  12. VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
  13. Content="{TemplateBinding ContentControl.Content}"
  14. ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
  15. ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  16. SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
  17. </Border>
  18. <ControlTemplate.Triggers>
  19. <Trigger Property="UIElement.IsEnabled" Value="False">
  20. <Setter TargetName="Bd" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  21. </Trigger>
  22. <MultiTrigger>
  23. <MultiTrigger.Conditions>
  24. <Condition Property="Selector.IsSelected" Value="False" />
  25. <Condition Property="UIElement.IsMouseOver" Value="True" />
  26. <Condition Property="UIElement.IsKeyboardFocused" Value="False" />
  27. </MultiTrigger.Conditions>
  28. <Setter TargetName="Bd" Property="Panel.Background" Value="#1F26A0DA" />
  29. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#A826A0DA" />
  30. </MultiTrigger>
  31. <MultiTrigger>
  32. <MultiTrigger.Conditions>
  33. <Condition Property="Selector.IsSelected" Value="True" />
  34. <Condition Property="UIElement.IsMouseOver" Value="False" />
  35. <Condition Property="UIElement.IsKeyboardFocused" Value="True" />
  36. </MultiTrigger.Conditions>
  37. <Setter TargetName="Bd" Property="Panel.Background" Value="#3D26A0DA" />
  38. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#26A0DA" />
  39. </MultiTrigger>
  40. <MultiTrigger>
  41. <MultiTrigger.Conditions>
  42. <Condition Property="Selector.IsSelected" Value="True" />
  43. <Condition Property="UIElement.IsMouseOver" Value="True" />
  44. </MultiTrigger.Conditions>
  45. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A477EDE" />
  46. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A477EDE" />
  47. </MultiTrigger>
  48. <MultiTrigger>
  49. <MultiTrigger.Conditions>
  50. <Condition Property="Selector.IsSelected" Value="True" />
  51. <Condition Property="UIElement.IsMouseOver" Value="False" />
  52. <Condition Property="UIElement.IsKeyboardFocused" Value="False" />
  53. </MultiTrigger.Conditions>
  54. <Setter TargetName="Bd" Property="Panel.Background" Value="#3DDADADA" />
  55. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#DADADA" />
  56. </MultiTrigger>
  57. <MultiTrigger>
  58. <MultiTrigger.Conditions>
  59. <Condition Property="Selector.IsSelected" Value="False" />
  60. <Condition Property="UIElement.IsMouseOver" Value="False" />
  61. <Condition Property="UIElement.IsKeyboardFocused" Value="True" />
  62. </MultiTrigger.Conditions>
  63. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#26A0DA" />
  64. </MultiTrigger>
  65. <MultiTrigger>
  66. <MultiTrigger.Conditions>
  67. <Condition Property="Selector.IsSelected" Value="False" />
  68. <Condition Property="UIElement.IsMouseOver" Value="True" />
  69. <Condition Property="UIElement.IsKeyboardFocused" Value="True" />
  70. </MultiTrigger.Conditions>
  71. <Setter TargetName="Bd" Property="Panel.Background" Value="#1A000000" />
  72. <Setter TargetName="Bd" Property="Border.BorderBrush" Value="#1A000000" />
  73. </MultiTrigger>
  74. </ControlTemplate.Triggers>
  75. </ControlTemplate>
  76. </ResourceDictionary>