ComboxStyle.xaml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. <Style x:Key="ZoomComboxItemStyle" TargetType="ComboBoxItem">
  77. <Setter Property="Template" Value="{StaticResource ComboxItem}" />
  78. <Setter Property="Width" Value="224" />
  79. <Setter Property="Height" Value="32" />
  80. <Setter Property="VerticalContentAlignment" Value="Center" />
  81. <Setter Property="FontFamily" Value="Segoe UI" />
  82. <Setter Property="FontSize" Value="14" />
  83. </Style>
  84. <Style x:Key="ContextMenuStyle" TargetType="{x:Type ContextMenu}">
  85. <Setter Property="SnapsToDevicePixels" Value="True" />
  86. <Setter Property="Grid.IsSharedSizeScope" Value="true" />
  87. <Setter Property="HasDropShadow" Value="True" />
  88. <Setter Property="Template">
  89. <Setter.Value>
  90. <ControlTemplate TargetType="{x:Type ContextMenu}">
  91. <Border Uid="Border_93">
  92. <Border.Style>
  93. <Style TargetType="{x:Type Border}">
  94. <Setter Property="Tag" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
  95. <Style.Triggers>
  96. <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource Self}}" Value="True">
  97. <Setter Property="Effect">
  98. <Setter.Value>
  99. <DropShadowEffect
  100. BlurRadius="4"
  101. Opacity="0.8"
  102. ShadowDepth="1" />
  103. </Setter.Value>
  104. </Setter>
  105. </DataTrigger>
  106. </Style.Triggers>
  107. </Style>
  108. </Border.Style>
  109. <Border
  110. Uid="Border_50"
  111. Background="{TemplateBinding Background}"
  112. BorderBrush="{TemplateBinding BorderBrush}"
  113. BorderThickness="{TemplateBinding BorderThickness}">
  114. <ScrollViewer
  115. Uid="ScrollViewer_9"
  116. CanContentScroll="True"
  117. Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer,
  118. TypeInTargetAssembly={x:Type FrameworkElement}}}">
  119. <ItemsPresenter
  120. Uid="ItemsPresenter_5"
  121. KeyboardNavigation.DirectionalNavigation="Cycle"
  122. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  123. </ScrollViewer>
  124. </Border>
  125. </Border>
  126. </ControlTemplate>
  127. </Setter.Value>
  128. </Setter>
  129. </Style>
  130. </ResourceDictionary>