ComboBox.xaml 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  4. <Style x:Key="ComboBoxFocusVisual">
  5. <Setter Property="Control.Template">
  6. <Setter.Value>
  7. <ControlTemplate>
  8. <Rectangle Margin="4,4,21,4" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
  9. </ControlTemplate>
  10. </Setter.Value>
  11. </Setter>
  12. </Style>
  13. <Geometry x:Key="DownArrowGeometry">M 0 0 L 5 5 L 10 0 Z</Geometry>
  14. <SolidColorBrush x:Key="ToggleButton_BD" Color="#FF243664"/>
  15. <SolidColorBrush x:Key="ToggleButton_BG" Color="#FF2F457F"/>
  16. <SolidColorBrush x:Key="ToggleButton_InnerHighlight" Color="#FF9FCDED"/>
  17. <SolidColorBrush x:Key="ToggleButton_InnerShadow" Color="#FF003A62"/>
  18. <SolidColorBrush x:Key="ToggleButton_BG_MouseOver" Color="#FF227BB8"/>
  19. <SolidColorBrush x:Key="ComboBox_DropDown_BG" Color="#FF2A6AB6"/>
  20. <SolidColorBrush x:Key="ComboBox_DropDown_BD" Color="#FF0A2B58"/>
  21. <SolidColorBrush x:Key="ComboBox_BG" Color="#FFC8E8FF"/>
  22. <SolidColorBrush x:Key="ComboBox_BD" Color="#FF999999"/>
  23. <SolidColorBrush x:Key="ComboBox_BD_InnerShadow" Color="#FF404040"/>
  24. <SolidColorBrush x:Key="ComboBox_BD_InnerHighlight" Color="#FFD2D2D2"/>
  25. <SolidColorBrush x:Key="ComboBox_BG_Unable" Color="#FFDBDBDB"/>
  26. <SolidColorBrush x:Key="ComboBox_BD_Unable" Color="Gray"/>
  27. <SolidColorBrush x:Key="ComboBox_BD_InnerShadow_Unable" Color="#FF838383"/>
  28. <SolidColorBrush x:Key="ToggleButton_Login_BD" Color="#FF092B58"/>
  29. <LinearGradientBrush x:Key="ToggleButton_Login_BG" EndPoint="0.5,1" StartPoint="0.5,0">
  30. <GradientStop Color="#FF0C4277" Offset="0"/>
  31. <GradientStop Color="#FF1373C8" Offset="1"/>
  32. </LinearGradientBrush>
  33. <SolidColorBrush x:Key="ToggleButton_Login_InnerHighlight" Color="#FF416C95"/>
  34. <SolidColorBrush x:Key="ToggleButton_Login_InnerShadow" Color="#FF093861"/>
  35. <SolidColorBrush x:Key="ToggleButton_Login_BD_MouseOver" Color="#FF05162c"/>
  36. <LinearGradientBrush x:Key="ToggleButton_Login_BG_MouseOver" EndPoint="0.5,1" StartPoint="0.5,0">
  37. <GradientStop Color="#FF115b9b" Offset="0"/>
  38. <GradientStop Color="#FF1b96de" Offset="1"/>
  39. </LinearGradientBrush>
  40. <SolidColorBrush x:Key="ToggleButton_Login_InnerHighlight_MouseOver" Color="#FF457fb1"/>
  41. <SolidColorBrush x:Key="ToggleButton_Login_InnerShadow_MouseOver" Color="#FF0d496d"/>
  42. <SolidColorBrush x:Key="ToggleButton_ArrowBG" Color="White"/>
  43. <SolidColorBrush x:Key="ToggleButton_BD_Unable" Color="#FF868686"/>
  44. <LinearGradientBrush x:Key="ToggleButton_BG_Unable" EndPoint="0.5,1" StartPoint="0.5,0">
  45. <GradientStop Color="#FFB1B1B1" Offset="0"/>
  46. <GradientStop Color="#FFDADADA" Offset="1"/>
  47. </LinearGradientBrush>
  48. <SolidColorBrush x:Key="ToggleButton_InnerHighlight_Unable" Color="#FFD8D8D8"/>
  49. <SolidColorBrush x:Key="ToggleButton_InnerShadow_Unable" Color="#FF6C6C6C"/>
  50. <SolidColorBrush x:Key="ComboBox_DropDown_Login_BG" Color="#FF2A6AB6"/>
  51. <SolidColorBrush x:Key="ComboBox_DropDown_Login_BD" Color="#FF0A2B58"/>
  52. <SolidColorBrush x:Key="ComboBox_Login_BG" Color="#FF1e4f8a"/>
  53. <SolidColorBrush x:Key="ComboBox_Login_BD" Color="#FF092b58"/>
  54. <!-- Toggle Button Style -->
  55. <Style x:Key="ComboBoxReadonlyToggleButton" TargetType="{x:Type ToggleButton}">
  56. <Setter Property="SnapsToDevicePixels" Value="True"/>
  57. <Setter Property="OverridesDefaultStyle" Value="true"/>
  58. <Setter Property="BorderBrush" Value="{DynamicResource ToggleButton_BD}"/>
  59. <Setter Property="Background" Value="{DynamicResource ToggleButton_BG}"/>
  60. <Setter Property="Border.CornerRadius" Value="3"/>
  61. <Setter Property="BorderThickness" Value="1"/>
  62. <Setter Property="IsTabStop" Value="false"/>
  63. <Setter Property="Focusable" Value="false"/>
  64. <Setter Property="ClickMode" Value="Press"/>
  65. <Setter Property="Template">
  66. <Setter.Value>
  67. <ControlTemplate TargetType="{x:Type ToggleButton}">
  68. <Grid Background="#00FFFFFF">
  69. <Grid.ColumnDefinitions>
  70. <ColumnDefinition/>
  71. <ColumnDefinition Width="25"/>
  72. </Grid.ColumnDefinitions>
  73. <Border x:Name="BG" Grid.Column="1" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding Border.CornerRadius}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Cursor="Hand">
  74. <Border x:Name="InnerBD_Highlight" Grid.Column="1" BorderThickness="1,1,0,0" BorderBrush="{DynamicResource ToggleButton_InnerHighlight}" CornerRadius="2">
  75. <Border x:Name="InnerBD_Shadow" BorderThickness="0,0,1,1" BorderBrush="{DynamicResource ToggleButton_InnerShadow}" CornerRadius="2">
  76. <Path x:Name="Arrow" Grid.Column="1" Data="{StaticResource DownArrowGeometry}" Fill="{DynamicResource ToggleButton_ArrowBG}" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand">
  77. <Path.Effect>
  78. <DropShadowEffect BlurRadius="0" ShadowDepth="1"/>
  79. </Path.Effect>
  80. </Path>
  81. </Border>
  82. </Border>
  83. </Border>
  84. </Grid>
  85. <ControlTemplate.Triggers>
  86. <Trigger Property="IsMouseOver" Value="true">
  87. <Setter Property="Background" TargetName="BG" Value="{DynamicResource ToggleButton_BG_MouseOver}"/>
  88. </Trigger>
  89. <Trigger Property="IsEnabled" Value="false">
  90. <Setter Property="BorderBrush" TargetName="BG" Value="{DynamicResource ToggleButton_BD_Unable}"/>
  91. <Setter Property="Background" TargetName="BG" Value="{DynamicResource ToggleButton_BG_Unable}"/>
  92. <Setter Property="Fill" TargetName="Arrow" Value="#FF999999"/>
  93. <Setter Property="Effect" TargetName="Arrow">
  94. <Setter.Value>
  95. <DropShadowEffect BlurRadius="0" ShadowDepth="1" Opacity="0"/>
  96. </Setter.Value>
  97. </Setter>
  98. <Setter Property="BorderBrush" TargetName="InnerBD_Shadow" Value="{DynamicResource ToggleButton_InnerShadow_Unable}"/>
  99. <Setter Property="BorderBrush" TargetName="InnerBD_Highlight" Value="{DynamicResource ToggleButton_InnerHighlight_Unable}"/>
  100. </Trigger>
  101. </ControlTemplate.Triggers>
  102. </ControlTemplate>
  103. </Setter.Value>
  104. </Setter>
  105. </Style>
  106. <Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  107. <Setter Property="BorderBrush" Value="{DynamicResource ToggleButton_BD}"/>
  108. <Setter Property="Background" Value="{DynamicResource ToggleButton_BG}"/>
  109. <Setter Property="Border.CornerRadius" Value="3"/>
  110. <Setter Property="BorderThickness" Value="1"/>
  111. <Setter Property="OverridesDefaultStyle" Value="true"/>
  112. <Setter Property="IsTabStop" Value="false"/>
  113. <Setter Property="Focusable" Value="false"/>
  114. <Setter Property="ClickMode" Value="Press"/>
  115. <Setter Property="Template">
  116. <Setter.Value>
  117. <ControlTemplate TargetType="{x:Type ToggleButton}">
  118. <Border x:Name="BG" BorderThickness="0" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding Border.CornerRadius}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Cursor="Hand">
  119. <Grid>
  120. <Border x:Name="InnerBD_Highlight" BorderThickness="2,2,0,0" BorderBrush="{DynamicResource ToggleButton_InnerHighlight}" CornerRadius="2">
  121. <Border x:Name="InnerBD_Shadow" BorderThickness="0,0,2,2" BorderBrush="{DynamicResource ToggleButton_InnerShadow}" CornerRadius="2"/>
  122. </Border>
  123. <Path x:Name="Arrow" Data="{StaticResource DownArrowGeometry}" Fill="{DynamicResource ToggleButton_ArrowBG}" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand">
  124. <Path.Effect>
  125. <DropShadowEffect BlurRadius="0" ShadowDepth="1"/>
  126. </Path.Effect>
  127. </Path>
  128. </Grid>
  129. </Border>
  130. <ControlTemplate.Triggers>
  131. <Trigger Property="IsMouseOver" Value="true">
  132. <Setter Property="Background" TargetName="BG" Value="{DynamicResource ToggleButton_BG_MouseOver}"/>
  133. </Trigger>
  134. <Trigger Property="IsEnabled" Value="false">
  135. <Setter Property="BorderBrush" TargetName="BG" Value="{DynamicResource ToggleButton_BD_Unable}"/>
  136. <Setter Property="Background" TargetName="BG" Value="{DynamicResource ToggleButton_BG_Unable}"/>
  137. <Setter Property="Fill" TargetName="Arrow" Value="#FF999999"/>
  138. <Setter Property="Effect" TargetName="Arrow">
  139. <Setter.Value>
  140. <DropShadowEffect BlurRadius="0" ShadowDepth="1" Opacity="0"/>
  141. </Setter.Value>
  142. </Setter>
  143. <Setter Property="BorderBrush" TargetName="InnerBD_Shadow" Value="{DynamicResource ToggleButton_InnerShadow_Unable}"/>
  144. <Setter Property="BorderBrush" TargetName="InnerBD_Highlight" Value="{DynamicResource ToggleButton_InnerHighlight_Unable}"/>
  145. </Trigger>
  146. </ControlTemplate.Triggers>
  147. </ControlTemplate>
  148. </Setter.Value>
  149. </Setter>
  150. </Style>
  151. <Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
  152. <Setter Property="OverridesDefaultStyle" Value="true"/>
  153. <Setter Property="AllowDrop" Value="true"/>
  154. <Setter Property="MinWidth" Value="0"/>
  155. <Setter Property="MinHeight" Value="0"/>
  156. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  157. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  158. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  159. <Setter Property="Template">
  160. <Setter.Value>
  161. <ControlTemplate TargetType="{x:Type TextBox}">
  162. <ScrollViewer x:Name="PART_ContentHost" Background="Transparent" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
  163. </ControlTemplate>
  164. </Setter.Value>
  165. </Setter>
  166. </Style>
  167. <ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
  168. <Border x:Name="Bd" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
  169. <Border BorderBrush="Gray" BorderThickness="0,0,1,1">
  170. <Grid x:Name="Placement" SnapsToDevicePixels="true">
  171. <Grid.ColumnDefinitions>
  172. <ColumnDefinition Width="*"/>
  173. <ColumnDefinition Width="25"/>
  174. </Grid.ColumnDefinitions>
  175. <Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
  176. <Border x:Name="DropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
  177. <ScrollViewer x:Name="DropDownScrollViewer">
  178. <Grid RenderOptions.ClearTypeHint="Enabled">
  179. <Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  180. <Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
  181. </Canvas>
  182. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  183. </Grid>
  184. </ScrollViewer>
  185. </Border>
  186. </Popup>
  187. <TextBox x:Name="PART_EditableTextBox" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
  188. <ToggleButton Grid.Column="1" Margin="1,1,0,0" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
  189. </Grid>
  190. </Border>
  191. </Border>
  192. <ControlTemplate.Triggers>
  193. <Trigger Property="IsKeyboardFocusWithin" Value="true">
  194. <Setter Property="Foreground" Value="Black"/>
  195. </Trigger>
  196. <Trigger Property="IsDropDownOpen" Value="true">
  197. </Trigger>
  198. <Trigger Property="HasItems" Value="false">
  199. <Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
  200. </Trigger>
  201. <Trigger Property="IsEnabled" Value="false">
  202. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  203. <Setter Property="Background" Value="#FFF4F4F4"/>
  204. </Trigger>
  205. <Trigger Property="IsGrouping" Value="true">
  206. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  207. </Trigger>
  208. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
  209. </Trigger>
  210. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  211. <Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  212. <Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  213. </Trigger>
  214. </ControlTemplate.Triggers>
  215. </ControlTemplate>
  216. <!-- ComboBox Style -->
  217. <Style TargetType="{x:Type ComboBox}">
  218. <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
  219. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
  220. <Setter Property="Background" Value="{DynamicResource ComboBox_BG}"/>
  221. <Setter Property="BorderBrush" Value="{DynamicResource ComboBox_BD}"/>
  222. <Setter Property="FontFamily" Value="Arial"/>
  223. <Setter Property="BorderThickness" Value="1"/>
  224. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
  225. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
  226. <Setter Property="Padding" Value="4,3"/>
  227. <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
  228. <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
  229. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  230. <Setter Property="Template">
  231. <Setter.Value>
  232. <ControlTemplate TargetType="{x:Type ComboBox}">
  233. <Grid x:Name="MainGrid" SnapsToDevicePixels="true">
  234. <Grid.ColumnDefinitions>
  235. <ColumnDefinition Width="*"/>
  236. <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
  237. </Grid.ColumnDefinitions>
  238. <Popup x:Name="PART_Popup" Grid.ColumnSpan="2" IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" Focusable="False" AllowsTransparency="True" PopupAnimation="Fade" VerticalOffset="2" >
  239. <Border x:Name="DropDownBorder" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
  240. <ScrollViewer x:Name="DropDownScrollViewer" Margin="0,5">
  241. <Grid RenderOptions.ClearTypeHint="Enabled">
  242. <Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  243. <Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
  244. </Canvas>
  245. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  246. </Grid>
  247. </ScrollViewer>
  248. </Border>
  249. <Popup.Effect>
  250. <DropShadowEffect Color="#71000000"/>
  251. </Popup.Effect>
  252. </Popup>
  253. <Border x:Name="Bd" Grid.ColumnSpan="2" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
  254. <Border x:Name="InnerBD_Shadow" BorderBrush="{DynamicResource ComboBox_BD_InnerShadow}" BorderThickness="1,1,0,0">
  255. <Border x:Name="InnerBD_Highlight" BorderBrush="{DynamicResource ComboBox_BD_InnerHighlight}" BorderThickness="0,0,1,1">
  256. </Border>
  257. </Border>
  258. </Border>
  259. <ToggleButton x:Name="ToggleButton" Style="{StaticResource ComboBoxReadonlyToggleButton}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Cursor="Hand" Margin="2"/>
  260. <ContentPresenter ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Content="{TemplateBinding SelectionBoxItem}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="4,3,20,3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
  261. </Grid>
  262. <ControlTemplate.Triggers>
  263. <Trigger Property="HasItems" Value="false">
  264. <Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
  265. </Trigger>
  266. <Trigger Property="IsEnabled" Value="false">
  267. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  268. <Setter Property="Background" TargetName="Bd" Value="{DynamicResource ComboBox_BG_Unable}"/>
  269. <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource ComboBox_BD_Unable}"/>
  270. <Setter Property="BorderBrush" TargetName="InnerBD_Shadow" Value="{DynamicResource ComboBox_BD_InnerShadow_Unable}"/>
  271. </Trigger>
  272. <Trigger Property="IsGrouping" Value="true">
  273. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  274. </Trigger>
  275. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  276. <Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  277. <Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  278. </Trigger>
  279. </ControlTemplate.Triggers>
  280. </ControlTemplate>
  281. </Setter.Value>
  282. </Setter>
  283. <Style.Triggers>
  284. <Trigger Property="IsEditable" Value="true">
  285. <Setter Property="BorderBrush" Value="Black"/>
  286. <Setter Property="Background" Value="White"/>
  287. <Setter Property="IsTabStop" Value="false"/>
  288. <Setter Property="Padding" Value="3"/>
  289. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
  290. </Trigger>
  291. </Style.Triggers>
  292. </Style>
  293. <SolidColorBrush x:Key="TopToggleButton_BD" Color="#FF243664"/>
  294. <SolidColorBrush x:Key="TopToggleButton_BG" Color="#FF2F457F"/>
  295. <SolidColorBrush x:Key="TopToggleButton_InnerHighlight" Color="#FF9FCDED"/>
  296. <SolidColorBrush x:Key="TopToggleButton_InnerShadow" Color="#FF003A62"/>
  297. <SolidColorBrush x:Key="TopToggleButton_BG_MouseOver" Color="#FF227BB8"/>
  298. <SolidColorBrush x:Key="TopComboBox_BG" Color="#FFC8E8FF"/>
  299. <SolidColorBrush x:Key="TopComboBox_BD" Color="#B2AFC2D3"/>
  300. <!-- Top Toggle Button Style -->
  301. <Style x:Key="TopComboBoxReadonlyToggleButton" TargetType="{x:Type ToggleButton}">
  302. <Setter Property="SnapsToDevicePixels" Value="True"/>
  303. <Setter Property="OverridesDefaultStyle" Value="true"/>
  304. <Setter Property="BorderBrush" Value="{DynamicResource TopToggleButton_BD}"/>
  305. <Setter Property="Background" Value="{DynamicResource TopToggleButton_BG}"/>
  306. <Setter Property="Border.CornerRadius" Value="3"/>
  307. <Setter Property="BorderThickness" Value="1"/>
  308. <Setter Property="IsTabStop" Value="false"/>
  309. <Setter Property="Focusable" Value="false"/>
  310. <Setter Property="ClickMode" Value="Press"/>
  311. <Setter Property="Template">
  312. <Setter.Value>
  313. <ControlTemplate TargetType="{x:Type ToggleButton}">
  314. <Grid Background="#00FFFFFF">
  315. <Grid.ColumnDefinitions>
  316. <ColumnDefinition/>
  317. <ColumnDefinition Width="25"/>
  318. </Grid.ColumnDefinitions>
  319. <Border x:Name="BG" Grid.Column="1" BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding Border.CornerRadius}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Cursor="Hand">
  320. <Border x:Name="InnerBD_Highlight" BorderThickness="1,1,0,0" BorderBrush="{DynamicResource TopToggleButton_InnerHighlight}" CornerRadius="2">
  321. <Border x:Name="InnerBD_Shadow" BorderThickness="0,0,1,1" BorderBrush="{DynamicResource TopToggleButton_InnerShadow}" CornerRadius="2">
  322. <Path x:Name="Arrow" Data="{StaticResource DownArrowGeometry}" Fill="{DynamicResource ToggleButton_ArrowBG}" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand">
  323. </Path>
  324. </Border>
  325. </Border>
  326. </Border>
  327. </Grid>
  328. <ControlTemplate.Triggers>
  329. <Trigger Property="IsMouseOver" Value="true">
  330. <Setter Property="Background" TargetName="BG" Value="{DynamicResource TopToggleButton_BG_MouseOver}"/>
  331. </Trigger>
  332. <Trigger Property="IsEnabled" Value="false">
  333. <Setter Property="BorderBrush" TargetName="BG" Value="{DynamicResource ToggleButton_BD_Unable}"/>
  334. <Setter Property="Background" TargetName="BG" Value="{DynamicResource ToggleButton_BG_Unable}"/>
  335. <Setter Property="Fill" TargetName="Arrow" Value="#FF999999"/>
  336. <Setter Property="Effect" TargetName="Arrow">
  337. <Setter.Value>
  338. <DropShadowEffect BlurRadius="0" ShadowDepth="1" Opacity="0"/>
  339. </Setter.Value>
  340. </Setter>
  341. <Setter Property="BorderBrush" TargetName="InnerBD_Shadow" Value="{DynamicResource ToggleButton_InnerShadow_Unable}"/>
  342. <Setter Property="BorderBrush" TargetName="InnerBD_Highlight" Value="{DynamicResource ToggleButton_InnerHighlight_Unable}"/>
  343. </Trigger>
  344. </ControlTemplate.Triggers>
  345. </ControlTemplate>
  346. </Setter.Value>
  347. </Setter>
  348. </Style>
  349. <Style x:Key="TopComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  350. <Setter Property="BorderBrush" Value="{DynamicResource ToggleButton_BD}"/>
  351. <Setter Property="Background" Value="{DynamicResource ToggleButton_BG}"/>
  352. <Setter Property="Border.CornerRadius" Value="3"/>
  353. <Setter Property="BorderThickness" Value="1"/>
  354. <Setter Property="OverridesDefaultStyle" Value="true"/>
  355. <Setter Property="IsTabStop" Value="false"/>
  356. <Setter Property="Focusable" Value="false"/>
  357. <Setter Property="ClickMode" Value="Press"/>
  358. <Setter Property="Template">
  359. <Setter.Value>
  360. <ControlTemplate TargetType="{x:Type ToggleButton}">
  361. <Border x:Name="BG" BorderThickness="0" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding Border.CornerRadius}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Cursor="Hand">
  362. <Grid>
  363. <Border x:Name="InnerBD_Highlight" BorderThickness="2,2,0,0" BorderBrush="{DynamicResource ToggleButton_InnerHighlight}" CornerRadius="2">
  364. <Border x:Name="InnerBD_Shadow" BorderThickness="0,0,2,2" BorderBrush="{DynamicResource ToggleButton_InnerShadow}" CornerRadius="2"/>
  365. </Border>
  366. <Path x:Name="Arrow" Data="{StaticResource DownArrowGeometry}" Fill="{DynamicResource ToggleButton_ArrowBG}" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand">
  367. <Path.Effect>
  368. <DropShadowEffect BlurRadius="0" ShadowDepth="1"/>
  369. </Path.Effect>
  370. </Path>
  371. </Grid>
  372. </Border>
  373. <ControlTemplate.Triggers>
  374. <Trigger Property="IsMouseOver" Value="true">
  375. <Setter Property="Background" TargetName="BG" Value="{DynamicResource ToggleButton_BG_MouseOver}"/>
  376. </Trigger>
  377. <Trigger Property="IsEnabled" Value="false">
  378. <Setter Property="BorderBrush" TargetName="BG" Value="{DynamicResource ToggleButton_BD_Unable}"/>
  379. <Setter Property="Background" TargetName="BG" Value="{DynamicResource ToggleButton_BG_Unable}"/>
  380. <Setter Property="Fill" TargetName="Arrow" Value="#FF999999"/>
  381. <Setter Property="Effect" TargetName="Arrow">
  382. <Setter.Value>
  383. <DropShadowEffect BlurRadius="0" ShadowDepth="1" Opacity="0"/>
  384. </Setter.Value>
  385. </Setter>
  386. <Setter Property="BorderBrush" TargetName="InnerBD_Shadow" Value="{DynamicResource ToggleButton_InnerShadow_Unable}"/>
  387. <Setter Property="BorderBrush" TargetName="InnerBD_Highlight" Value="{DynamicResource ToggleButton_InnerHighlight_Unable}"/>
  388. </Trigger>
  389. </ControlTemplate.Triggers>
  390. </ControlTemplate>
  391. </Setter.Value>
  392. </Setter>
  393. </Style>
  394. <Style x:Key="TopComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
  395. <Setter Property="OverridesDefaultStyle" Value="true"/>
  396. <Setter Property="AllowDrop" Value="true"/>
  397. <Setter Property="MinWidth" Value="0"/>
  398. <Setter Property="MinHeight" Value="0"/>
  399. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  400. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  401. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  402. <Setter Property="Template">
  403. <Setter.Value>
  404. <ControlTemplate TargetType="{x:Type TextBox}">
  405. <ScrollViewer x:Name="PART_ContentHost" Background="Transparent" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
  406. </ControlTemplate>
  407. </Setter.Value>
  408. </Setter>
  409. </Style>
  410. <ControlTemplate x:Key="TopComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
  411. <Border x:Name="Bd" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
  412. <Border BorderBrush="Gray" BorderThickness="0,0,1,1">
  413. <Grid x:Name="Placement" SnapsToDevicePixels="true">
  414. <Grid.ColumnDefinitions>
  415. <ColumnDefinition Width="*"/>
  416. <ColumnDefinition Width="25"/>
  417. </Grid.ColumnDefinitions>
  418. <Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
  419. <Border x:Name="DropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
  420. <ScrollViewer x:Name="DropDownScrollViewer">
  421. <Grid RenderOptions.ClearTypeHint="Enabled">
  422. <Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  423. <Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
  424. </Canvas>
  425. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  426. </Grid>
  427. </ScrollViewer>
  428. </Border>
  429. </Popup>
  430. <TextBox x:Name="PART_EditableTextBox" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
  431. <ToggleButton Grid.Column="1" Margin="1,1,0,0" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
  432. </Grid>
  433. </Border>
  434. </Border>
  435. <ControlTemplate.Triggers>
  436. <Trigger Property="IsKeyboardFocusWithin" Value="true">
  437. <Setter Property="Foreground" Value="Black"/>
  438. </Trigger>
  439. <Trigger Property="IsDropDownOpen" Value="true">
  440. </Trigger>
  441. <Trigger Property="HasItems" Value="false">
  442. <Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
  443. </Trigger>
  444. <Trigger Property="IsEnabled" Value="false">
  445. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  446. <Setter Property="Background" Value="#FFF4F4F4"/>
  447. </Trigger>
  448. <Trigger Property="IsGrouping" Value="true">
  449. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  450. </Trigger>
  451. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
  452. </Trigger>
  453. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  454. <Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  455. <Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  456. </Trigger>
  457. </ControlTemplate.Triggers>
  458. </ControlTemplate>
  459. <!-- Top ComboBox Style -->
  460. <Style x:Key="Top_ComboBox" TargetType="{x:Type ComboBox}">
  461. <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
  462. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
  463. <Setter Property="Background" Value="{DynamicResource TopComboBox_BG}"/>
  464. <Setter Property="BorderBrush" Value="{DynamicResource TopComboBox_BD}"/>
  465. <Setter Property="FontFamily" Value="Arial"/>
  466. <Setter Property="BorderThickness" Value="1"/>
  467. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
  468. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
  469. <Setter Property="Margin" Value="0,2,2,2"/>
  470. <Setter Property="Padding" Value="4,3"/>
  471. <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
  472. <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
  473. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  474. <Setter Property="Template">
  475. <Setter.Value>
  476. <ControlTemplate TargetType="{x:Type ComboBox}">
  477. <Grid x:Name="MainGrid" SnapsToDevicePixels="true">
  478. <Grid.ColumnDefinitions>
  479. <ColumnDefinition Width="*"/>
  480. <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
  481. </Grid.ColumnDefinitions>
  482. <Popup x:Name="PART_Popup" Grid.ColumnSpan="2" IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" Focusable="False" AllowsTransparency="True" PopupAnimation="Fade" VerticalOffset="2" >
  483. <Border x:Name="DropDownBorder" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
  484. <ScrollViewer x:Name="DropDownScrollViewer" Margin="0,5">
  485. <Grid RenderOptions.ClearTypeHint="Enabled">
  486. <Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  487. <Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
  488. </Canvas>
  489. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  490. </Grid>
  491. </ScrollViewer>
  492. </Border>
  493. <Popup.Effect>
  494. <DropShadowEffect Color="#71000000"/>
  495. </Popup.Effect>
  496. </Popup>
  497. <Border x:Name="Bd" Grid.ColumnSpan="2" CornerRadius="0,6,6,0" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
  498. </Border>
  499. <ToggleButton x:Name="ToggleButton" Style="{StaticResource TopComboBoxReadonlyToggleButton}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Cursor="Hand" Margin="3,2"/>
  500. <ContentPresenter ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Content="{TemplateBinding SelectionBoxItem}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="4,3,20,3" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
  501. </Grid>
  502. <ControlTemplate.Triggers>
  503. <Trigger Property="HasItems" Value="false">
  504. <Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
  505. </Trigger>
  506. <Trigger Property="IsEnabled" Value="false">
  507. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  508. <Setter Property="Background" TargetName="Bd" Value="{DynamicResource ComboBox_BG_Unable}"/>
  509. <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource ComboBox_BD_Unable}"/>
  510. </Trigger>
  511. <Trigger Property="IsGrouping" Value="true">
  512. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  513. </Trigger>
  514. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  515. <Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  516. <Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  517. </Trigger>
  518. </ControlTemplate.Triggers>
  519. </ControlTemplate>
  520. </Setter.Value>
  521. </Setter>
  522. <Style.Triggers>
  523. <Trigger Property="IsEditable" Value="true">
  524. <Setter Property="BorderBrush" Value="Black"/>
  525. <Setter Property="Background" Value="White"/>
  526. <Setter Property="IsTabStop" Value="false"/>
  527. <Setter Property="Padding" Value="3"/>
  528. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
  529. </Trigger>
  530. </Style.Triggers>
  531. </Style>
  532. <!-- Login ComboBox Style -->
  533. <Style x:Key="ComboBoxReadonlyToggleButton_Login" TargetType="{x:Type ToggleButton}">
  534. <Setter Property="SnapsToDevicePixels" Value="True"/>
  535. <Setter Property="OverridesDefaultStyle" Value="true"/>
  536. <Setter Property="BorderBrush" Value="{DynamicResource ToggleButton_Login_BD}"/>
  537. <Setter Property="Background" Value="{DynamicResource ToggleButton_Login_BG}"/>
  538. <Setter Property="BorderThickness" Value="1"/>
  539. <Setter Property="IsTabStop" Value="false"/>
  540. <Setter Property="Focusable" Value="false"/>
  541. <Setter Property="ClickMode" Value="Press"/>
  542. <Setter Property="Template">
  543. <Setter.Value>
  544. <ControlTemplate TargetType="{x:Type ToggleButton}">
  545. <Border x:Name="BG" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Cursor="Hand">
  546. <Grid>
  547. <Border x:Name="InnerBD_Highlight" BorderThickness="1.5,1.5,0,0" BorderBrush="{DynamicResource ToggleButton_Login_InnerHighlight}">
  548. <Border x:Name="InnerBD_Shadow" BorderThickness="0,0,1.5,1.5" BorderBrush="{DynamicResource ToggleButton_Login_InnerShadow}"/>
  549. </Border>
  550. <Path x:Name="Arrow" Data="{StaticResource DownArrowGeometry}" Fill="{DynamicResource ToggleButton_ArrowBG}" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand">
  551. <Path.Effect>
  552. <DropShadowEffect BlurRadius="0" ShadowDepth="1"/>
  553. </Path.Effect>
  554. </Path>
  555. </Grid>
  556. </Border>
  557. <ControlTemplate.Triggers>
  558. <Trigger Property="IsMouseOver" Value="true">
  559. <Setter Property="BorderBrush" TargetName="BG" Value="{DynamicResource ToggleButton_Login_BD_MouseOver}"/>
  560. <Setter Property="Background" TargetName="BG" Value="{DynamicResource ToggleButton_Login_BG_MouseOver}"/>
  561. <Setter Property="BorderBrush" TargetName="InnerBD_Shadow" Value="{DynamicResource ToggleButton_Login_InnerShadow_MouseOver}"/>
  562. <Setter Property="BorderBrush" TargetName="InnerBD_Highlight" Value="{DynamicResource ToggleButton_Login_InnerHighlight_MouseOver}"/>
  563. </Trigger>
  564. <Trigger Property="IsEnabled" Value="false">
  565. <Setter Property="BorderBrush" TargetName="BG" Value="{DynamicResource ToggleButton_BD_Unable}"/>
  566. <Setter Property="Background" TargetName="BG" Value="{DynamicResource ToggleButton_BG_Unable}"/>
  567. <Setter Property="Fill" TargetName="Arrow" Value="#FF999999"/>
  568. <Setter Property="Effect" TargetName="Arrow">
  569. <Setter.Value>
  570. <DropShadowEffect BlurRadius="0" ShadowDepth="1" Opacity="0"/>
  571. </Setter.Value>
  572. </Setter>
  573. <Setter Property="BorderBrush" TargetName="InnerBD_Shadow" Value="{DynamicResource ToggleButton_InnerShadow_Unable}"/>
  574. <Setter Property="BorderBrush" TargetName="InnerBD_Highlight" Value="{DynamicResource ToggleButton_InnerHighlight_Unable}"/>
  575. </Trigger>
  576. </ControlTemplate.Triggers>
  577. </ControlTemplate>
  578. </Setter.Value>
  579. </Setter>
  580. </Style>
  581. <Style x:Key="Login_ComboBox" TargetType="{x:Type ComboBox}">
  582. <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}"/>
  583. <Setter Property="Foreground" Value="{DynamicResource FG_White}"/>
  584. <Setter Property="Background" Value="{DynamicResource ComboBox_Login_BG}"/>
  585. <Setter Property="BorderBrush" Value="{DynamicResource ComboBox_Login_BD}"/>
  586. <Setter Property="FontFamily" Value="Arial"/>
  587. <Setter Property="BorderThickness" Value="2"/>
  588. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
  589. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
  590. <Setter Property="Padding" Value="4,3"/>
  591. <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
  592. <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
  593. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  594. <Setter Property="Template">
  595. <Setter.Value>
  596. <ControlTemplate TargetType="{x:Type ComboBox}">
  597. <Border x:Name="Bd" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
  598. <Grid x:Name="MainGrid" SnapsToDevicePixels="true">
  599. <Grid.ColumnDefinitions>
  600. <ColumnDefinition Width="*"/>
  601. <ColumnDefinition Width="30"/>
  602. </Grid.ColumnDefinitions>
  603. <Popup x:Name="PART_Popup" Grid.ColumnSpan="2" IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" Focusable="False" AllowsTransparency="True" PopupAnimation="Fade" VerticalOffset="2" >
  604. <Border x:Name="DropDownBorder" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" BorderBrush="{DynamicResource ComboBox_DropDown_Login_BD}" BorderThickness="1" Background="{DynamicResource ComboBox_DropDown_Login_BG}">
  605. <ScrollViewer x:Name="DropDownScrollViewer" Margin="0,5">
  606. <Grid RenderOptions.ClearTypeHint="Enabled">
  607. <Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  608. <Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
  609. </Canvas>
  610. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  611. </Grid>
  612. </ScrollViewer>
  613. </Border>
  614. <Popup.Effect>
  615. <DropShadowEffect Color="#71000000"/>
  616. </Popup.Effect>
  617. </Popup>
  618. <ToggleButton Margin="1" Grid.Column="1" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxReadonlyToggleButton_Login}"/>
  619. <ContentPresenter ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Content="{TemplateBinding SelectionBoxItem}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
  620. </Grid>
  621. </Border>
  622. <ControlTemplate.Triggers>
  623. <Trigger Property="HasItems" Value="false">
  624. <Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
  625. </Trigger>
  626. <Trigger Property="IsEnabled" Value="false">
  627. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  628. <Setter Property="Background" TargetName="Bd" Value="#FFDBDBDB"/>
  629. <Setter Property="BorderBrush" TargetName="Bd" Value="Gray"/>
  630. </Trigger>
  631. <Trigger Property="IsGrouping" Value="true">
  632. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  633. </Trigger>
  634. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  635. <Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  636. <Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  637. </Trigger>
  638. </ControlTemplate.Triggers>
  639. </ControlTemplate>
  640. </Setter.Value>
  641. </Setter>
  642. <Style.Triggers>
  643. <Trigger Property="IsEditable" Value="true">
  644. <Setter Property="BorderBrush" Value="Black"/>
  645. <Setter Property="Background" Value="White"/>
  646. <Setter Property="IsTabStop" Value="false"/>
  647. <Setter Property="Padding" Value="3"/>
  648. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
  649. </Trigger>
  650. </Style.Triggers>
  651. </Style>
  652. </ResourceDictionary>