终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

201 行
10 KiB

  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <!--#region ComboBox 样式-->
  3. <!-- ComBoBox项选中背景色 -->
  4. <SolidColorBrush x:Key="ComboBoxSelectdBackground" Color="#AA3ba7f2" />
  5. <!-- ComBoBox项鼠标经过背景色 -->
  6. <SolidColorBrush x:Key="ComboBoxMouseOverBackground" Color="#553ba7f2" />
  7. <!-- ComBoBox项选中前景色 -->
  8. <SolidColorBrush x:Key="ComboBoxSelectedForeground" Color="#DDD" />
  9. <!-- ComBoBox项鼠标经过前景色 -->
  10. <SolidColorBrush x:Key="ComboBoxMouseOverForegrond" Color="#DDD" />
  11. <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  12. <Grid Height="25" HorizontalAlignment="Stretch">
  13. <Grid.ColumnDefinitions>
  14. <ColumnDefinition Width="*" />
  15. <ColumnDefinition Width="30" />
  16. </Grid.ColumnDefinitions>
  17. <Border
  18. Grid.ColumnSpan="2"
  19. Background="White"
  20. Opacity="0" />
  21. <TextBlock
  22. Grid.Column="1"
  23. Margin="0,0,5,0"
  24. HorizontalAlignment="Right"
  25. VerticalAlignment="Center"
  26. FontFamily="../Fonts/#iconfont"
  27. FontSize="14"
  28. Foreground="#FF23CACA"
  29. Text="&#xe64d;" />
  30. <!--<Path
  31. x:Name="Arrow"
  32. Grid.Column="1"
  33. HorizontalAlignment="Center"
  34. VerticalAlignment="Center"
  35. Data="M 0 0 6 6 12 0 Z"
  36. Fill="#aa20FDFA"
  37. Stretch="None">
  38. <Path.Effect>
  39. <DropShadowEffect
  40. BlurRadius="10"
  41. Direction="90"
  42. Opacity="1"
  43. RenderingBias="Quality"
  44. ShadowDepth="0"
  45. Color="#aa20FDFA" />
  46. </Path.Effect>
  47. </Path>-->
  48. </Grid>
  49. <!--<ControlTemplate.Triggers>
  50. <Trigger Property="IsChecked" Value="true">
  51. <Setter TargetName="Arrow" Property="RenderTransform">
  52. <Setter.Value>
  53. <RotateTransform Angle="180" CenterX="6" CenterY="3" />
  54. </Setter.Value>
  55. </Setter>
  56. <Setter TargetName="Arrow" Property="Margin" Value="0,0,0,2" />
  57. </Trigger>
  58. </ControlTemplate.Triggers>-->
  59. </ControlTemplate>
  60. <Style x:Key="ComboBoxStyle" TargetType="{x:Type ComboBox}">
  61. <Setter Property="BorderThickness" Value="0" />
  62. <Setter Property="ItemContainerStyle">
  63. <Setter.Value>
  64. <Style TargetType="ComboBoxItem">
  65. <Setter Property="Height" Value="25" />
  66. <Setter Property="Template">
  67. <Setter.Value>
  68. <ControlTemplate TargetType="{x:Type ComboBoxItem}">
  69. <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
  70. <Border x:Name="_borderbg" Background="Transparent" />
  71. <TextBlock
  72. x:Name="_txt"
  73. Margin="5,0,3,0"
  74. HorizontalAlignment="Left"
  75. VerticalAlignment="Center"
  76. Foreground="#DDD"
  77. Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" />
  78. <Border
  79. x:Name="_border"
  80. Background="#103153"
  81. Opacity="0" />
  82. </Grid>
  83. <ControlTemplate.Triggers>
  84. <Trigger Property="IsSelected" Value="true">
  85. <Setter TargetName="_txt" Property="Foreground" Value="{StaticResource ComboBoxSelectedForeground}" />
  86. <Setter TargetName="_borderbg" Property="Background" Value="{StaticResource ComboBoxSelectdBackground}" />
  87. </Trigger>
  88. <MultiTrigger>
  89. <MultiTrigger.Conditions>
  90. <Condition Property="IsSelected" Value="false" />
  91. <Condition Property="IsMouseOver" Value="true" />
  92. </MultiTrigger.Conditions>
  93. <Setter TargetName="_borderbg" Property="Background" Value="{StaticResource ComboBoxMouseOverBackground}" />
  94. <Setter TargetName="_txt" Property="Foreground" Value="{StaticResource ComboBoxMouseOverForegrond}" />
  95. </MultiTrigger>
  96. </ControlTemplate.Triggers>
  97. </ControlTemplate>
  98. </Setter.Value>
  99. </Setter>
  100. </Style>
  101. </Setter.Value>
  102. </Setter>
  103. <Setter Property="Template">
  104. <Setter.Value>
  105. <ControlTemplate TargetType="{x:Type ComboBox}">
  106. <Grid>
  107. <Grid.ColumnDefinitions>
  108. <ColumnDefinition Width="0.7*" />
  109. <ColumnDefinition Width="0.3*" MaxWidth="30" />
  110. </Grid.ColumnDefinitions>
  111. <Border
  112. x:Name="_prybr"
  113. Grid.Column="0"
  114. Grid.ColumnSpan="2"
  115. BorderBrush="{TemplateBinding BorderBrush}"
  116. BorderThickness="{TemplateBinding BorderThickness}"
  117. CornerRadius="0" />
  118. <ContentPresenter
  119. x:Name="ContentSite"
  120. Margin="3,3,0,3"
  121. HorizontalAlignment="Center"
  122. VerticalAlignment="Center"
  123. Content="{TemplateBinding SelectionBoxItem}"
  124. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  125. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  126. IsHitTestVisible="False" />
  127. <!-- ToggleButton 已数据绑定到 ComboBox 本身以切换 IsDropDownOpen -->
  128. <ToggleButton
  129. x:Name="ToggleButton"
  130. Grid.Column="0"
  131. Grid.ColumnSpan="2"
  132. ClickMode="Press"
  133. Focusable="false"
  134. IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  135. Template="{StaticResource ComboBoxToggleButton}" />
  136. <!-- 必须将 TextBox 命名为 PART_EditableTextBox,否则 ComboBox 将无法识别它 -->
  137. <TextBox
  138. x:Name="PART_EditableTextBox"
  139. Margin="2,0,0,0"
  140. VerticalAlignment="Center"
  141. Background="Transparent"
  142. BorderThickness="0"
  143. Focusable="True"
  144. IsReadOnly="{TemplateBinding IsReadOnly}"
  145. Visibility="Hidden" />
  146. <!-- Popup 可显示 ComboBox 中的项列表。IsOpen 已数据绑定到通过 ComboBoxToggleButton 来切换的 IsDropDownOpen -->
  147. <Popup
  148. x:Name="Popup"
  149. AllowsTransparency="True"
  150. Focusable="False"
  151. IsOpen="{TemplateBinding IsDropDownOpen}"
  152. Placement="Bottom"
  153. PopupAnimation="Slide">
  154. <Grid
  155. x:Name="DropDown"
  156. MinWidth="{TemplateBinding ActualWidth}"
  157. MaxHeight="150"
  158. SnapsToDevicePixels="True">
  159. <Border
  160. x:Name="DropDownBorder"
  161. BorderBrush="#3ba7f2"
  162. BorderThickness="0" />
  163. <ScrollViewer
  164. Margin="1"
  165. CanContentScroll="True"
  166. HorizontalScrollBarVisibility="Auto"
  167. SnapsToDevicePixels="True"
  168. VerticalScrollBarVisibility="Auto">
  169. <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
  170. <!-- 一下可以设置列表背景色 -->
  171. <StackPanel
  172. Background="#103153"
  173. IsItemsHost="True"
  174. KeyboardNavigation.DirectionalNavigation="Contained" />
  175. </ScrollViewer>
  176. </Grid>
  177. </Popup>
  178. </Grid>
  179. <ControlTemplate.Triggers>
  180. <Trigger Property="IsEditable" Value="true">
  181. <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible" />
  182. </Trigger>
  183. <Trigger Property="IsMouseOver" Value="True">
  184. <Setter TargetName="_prybr" Property="BorderBrush" Value="#aa3ba7f2" />
  185. <!--<Setter Property="Background" Value="#553ba7f2" TargetName="_prybr"/>-->
  186. </Trigger>
  187. </ControlTemplate.Triggers>
  188. </ControlTemplate>
  189. </Setter.Value>
  190. </Setter>
  191. </Style>
  192. <!--#endregion-->
  193. </ResourceDictionary>