ComboBoxStyle.xaml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  4. <Style x:Key="FocusVisual">
  5. <Setter Property="Control.Template">
  6. <Setter.Value>
  7. <ControlTemplate>
  8. <Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
  9. </ControlTemplate>
  10. </Setter.Value>
  11. </Setter>
  12. </Style>
  13. <SolidColorBrush x:Key="TextBox.Static.Background" Color="#FFFFFFFF"/>
  14. <Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
  15. <Setter Property="OverridesDefaultStyle" Value="true"/>
  16. <Setter Property="AllowDrop" Value="true"/>
  17. <Setter Property="MinWidth" Value="0"/>
  18. <Setter Property="MinHeight" Value="0"/>
  19. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  20. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  21. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  22. <Setter Property="Template">
  23. <Setter.Value>
  24. <ControlTemplate TargetType="{x:Type TextBox}">
  25. <ScrollViewer x:Name="PART_ContentHost" Background="Transparent" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
  26. </ControlTemplate>
  27. </Setter.Value>
  28. </Setter>
  29. </Style>
  30. <LinearGradientBrush x:Key="ComboBox.Static.Background" EndPoint="0,1" StartPoint="0,0">
  31. <GradientStop Color="#FFF0F0F0" Offset="0.0"/>
  32. <GradientStop Color="#FFE5E5E5" Offset="1.0"/>
  33. </LinearGradientBrush>
  34. <SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFACACAC"/>
  35. <SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF606060"/>
  36. <SolidColorBrush x:Key="ComboBox.Static.Editable.Background" Color="#FFFFFFFF"/>
  37. <SolidColorBrush x:Key="ComboBox.Static.Editable.Border" Color="#FFABADB3"/>
  38. <SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Background" Color="Transparent"/>
  39. <SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Border" Color="Transparent"/>
  40. <LinearGradientBrush x:Key="ComboBox.MouseOver.Background" EndPoint="0,1" StartPoint="0,0">
  41. <GradientStop Color="#FFECF4FC" Offset="0.0"/>
  42. <GradientStop Color="#FFDCECFC" Offset="1.0"/>
  43. </LinearGradientBrush>
  44. <SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF7EB4EA"/>
  45. <SolidColorBrush x:Key="ComboBox.MouseOver.Glyph" Color="#FF000000"/>
  46. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Background" Color="#FFFFFFFF"/>
  47. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Border" Color="#FF7EB4EA"/>
  48. <LinearGradientBrush x:Key="ComboBox.MouseOver.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
  49. <GradientStop Color="#FFEBF4FC" Offset="0.0"/>
  50. <GradientStop Color="#FFDCECFC" Offset="1.0"/>
  51. </LinearGradientBrush>
  52. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Button.Border" Color="#FF7EB4EA"/>
  53. <LinearGradientBrush x:Key="ComboBox.Pressed.Background" EndPoint="0,1" StartPoint="0,0">
  54. <GradientStop Color="#FFDAECFC" Offset="0.0"/>
  55. <GradientStop Color="#FFC4E0FC" Offset="1.0"/>
  56. </LinearGradientBrush>
  57. <SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="#FF569DE5"/>
  58. <SolidColorBrush x:Key="ComboBox.Pressed.Glyph" Color="#FF000000"/>
  59. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Background" Color="#FFFFFFFF"/>
  60. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Border" Color="#FF569DE5"/>
  61. <LinearGradientBrush x:Key="ComboBox.Pressed.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
  62. <GradientStop Color="#FFDAEBFC" Offset="0.0"/>
  63. <GradientStop Color="#FFC4E0FC" Offset="1.0"/>
  64. </LinearGradientBrush>
  65. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Button.Border" Color="#FF569DE5"/>
  66. <SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF0F0F0"/>
  67. <SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFD9D9D9"/>
  68. <SolidColorBrush x:Key="ComboBox.Disabled.Glyph" Color="#FFBFBFBF"/>
  69. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Background" Color="#FFFFFFFF"/>
  70. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Border" Color="#FFBFBFBF"/>
  71. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent"/>
  72. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent"/>
  73. <Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  74. <Setter Property="OverridesDefaultStyle" Value="true"/>
  75. <Setter Property="IsTabStop" Value="false"/>
  76. <Setter Property="Focusable" Value="false"/>
  77. <Setter Property="ClickMode" Value="Press"/>
  78. <Setter Property="Template">
  79. <Setter.Value>
  80. <ControlTemplate TargetType="{x:Type ToggleButton}">
  81. <Border x:Name="templateRoot" Background="Transparent" CornerRadius="2" BorderBrush="{StaticResource ComboBox.Static.Border}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
  82. <Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="true" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
  83. <Path x:Name="arrow" Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z" Fill="{StaticResource ComboBox.Static.Glyph}" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/>
  84. </Border>
  85. </Border>
  86. <ControlTemplate.Triggers>
  87. <MultiDataTrigger>
  88. <MultiDataTrigger.Conditions>
  89. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  90. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/>
  91. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/>
  92. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/>
  93. </MultiDataTrigger.Conditions>
  94. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Background}"/>
  95. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Border}"/>
  96. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Background}"/>
  97. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Border}"/>
  98. </MultiDataTrigger>
  99. <Trigger Property="IsMouseOver" Value="true">
  100. <Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.MouseOver.Glyph}"/>
  101. </Trigger>
  102. <MultiDataTrigger>
  103. <MultiDataTrigger.Conditions>
  104. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
  105. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  106. </MultiDataTrigger.Conditions>
  107. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Background}"/>
  108. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Border}"/>
  109. </MultiDataTrigger>
  110. <MultiDataTrigger>
  111. <MultiDataTrigger.Conditions>
  112. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
  113. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  114. </MultiDataTrigger.Conditions>
  115. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Background}"/>
  116. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Border}"/>
  117. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Background}"/>
  118. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Border}"/>
  119. </MultiDataTrigger>
  120. <Trigger Property="IsPressed" Value="true">
  121. <Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Pressed.Glyph}"/>
  122. </Trigger>
  123. <MultiDataTrigger>
  124. <MultiDataTrigger.Conditions>
  125. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
  126. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  127. </MultiDataTrigger.Conditions>
  128. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Background}"/>
  129. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Border}"/>
  130. </MultiDataTrigger>
  131. <MultiDataTrigger>
  132. <MultiDataTrigger.Conditions>
  133. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
  134. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  135. </MultiDataTrigger.Conditions>
  136. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Background}"/>
  137. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Border}"/>
  138. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Background}"/>
  139. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Border}"/>
  140. </MultiDataTrigger>
  141. <Trigger Property="IsEnabled" Value="false">
  142. <Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Disabled.Glyph}"/>
  143. </Trigger>
  144. <MultiDataTrigger>
  145. <MultiDataTrigger.Conditions>
  146. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
  147. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  148. </MultiDataTrigger.Conditions>
  149. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Background}"/>
  150. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Border}"/>
  151. </MultiDataTrigger>
  152. <MultiDataTrigger>
  153. <MultiDataTrigger.Conditions>
  154. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
  155. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  156. </MultiDataTrigger.Conditions>
  157. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Background}"/>
  158. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Border}"/>
  159. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Background}"/>
  160. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Border}"/>
  161. </MultiDataTrigger>
  162. </ControlTemplate.Triggers>
  163. </ControlTemplate>
  164. </Setter.Value>
  165. </Setter>
  166. </Style>
  167. <ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
  168. <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
  169. <Grid.ColumnDefinitions>
  170. <ColumnDefinition Width="*"/>
  171. <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
  172. </Grid.ColumnDefinitions>
  173. <Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  174. <theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  175. <Border x:Name="dropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" CornerRadius="2" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
  176. <ScrollViewer x:Name="DropDownScrollViewer">
  177. <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
  178. <Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  179. <Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
  180. </Canvas>
  181. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  182. </Grid>
  183. </ScrollViewer>
  184. </Border>
  185. </theme:SystemDropShadowChrome>
  186. </Popup>
  187. <ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
  188. <Border x:Name="border" Background="{StaticResource TextBox.Static.Background}" Margin="{TemplateBinding BorderThickness}">
  189. <TextBox x:Name="PART_EditableTextBox" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
  190. </Border>
  191. </Grid>
  192. <ControlTemplate.Triggers>
  193. <Trigger Property="IsEnabled" Value="false">
  194. <Setter Property="Opacity" TargetName="border" Value="0.56"/>
  195. </Trigger>
  196. <Trigger Property="IsKeyboardFocusWithin" Value="true">
  197. <Setter Property="Foreground" Value="Black"/>
  198. </Trigger>
  199. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
  200. <Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
  201. <Setter Property="Color" TargetName="shadow" Value="#71000000"/>
  202. </Trigger>
  203. <Trigger Property="HasItems" Value="false">
  204. <Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
  205. </Trigger>
  206. <MultiTrigger>
  207. <MultiTrigger.Conditions>
  208. <Condition Property="IsGrouping" Value="true"/>
  209. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
  210. </MultiTrigger.Conditions>
  211. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  212. </MultiTrigger>
  213. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  214. <Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  215. <Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  216. </Trigger>
  217. </ControlTemplate.Triggers>
  218. </ControlTemplate>
  219. <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
  220. <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
  221. <Grid.ColumnDefinitions>
  222. <ColumnDefinition Width="*"/>
  223. <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
  224. </Grid.ColumnDefinitions>
  225. <Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  226. <theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  227. <Border x:Name="dropDownBorder" CornerRadius="2" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
  228. <ScrollViewer x:Name="DropDownScrollViewer">
  229. <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
  230. <Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  231. <Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
  232. </Canvas>
  233. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  234. </Grid>
  235. </ScrollViewer>
  236. </Border>
  237. </theme:SystemDropShadowChrome>
  238. </Popup>
  239. <ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
  240. <ContentPresenter x:Name="contentPresenter" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  241. </Grid>
  242. <ControlTemplate.Triggers>
  243. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
  244. <Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
  245. <Setter Property="Color" TargetName="shadow" Value="#71000000"/>
  246. </Trigger>
  247. <Trigger Property="HasItems" Value="false">
  248. <Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
  249. </Trigger>
  250. <MultiTrigger>
  251. <MultiTrigger.Conditions>
  252. <Condition Property="IsGrouping" Value="true"/>
  253. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
  254. </MultiTrigger.Conditions>
  255. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  256. </MultiTrigger>
  257. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  258. <Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  259. <Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  260. </Trigger>
  261. </ControlTemplate.Triggers>
  262. </ControlTemplate>
  263. <Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
  264. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
  265. <Setter Property="Background" Value="{StaticResource ComboBox.Static.Background}"/>
  266. <Setter Property="BorderBrush" Value="{StaticResource ComboBox.Static.Border}"/>
  267. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
  268. <Setter Property="BorderThickness" Value="1"/>
  269. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
  270. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
  271. <Setter Property="Padding" Value="6,3,5,3"/>
  272. <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
  273. <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
  274. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  275. <Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/>
  276. <Style.Triggers>
  277. <Trigger Property="IsEditable" Value="true">
  278. <Setter Property="IsTabStop" Value="false"/>
  279. <Setter Property="Padding" Value="2"/>
  280. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
  281. </Trigger>
  282. </Style.Triggers>
  283. </Style>
  284. </ResourceDictionary>