CheckComboBoxBaseStyle.xaml 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:hc="clr-namespace:HandyControl.Controls" xmlns:ex="clr-namespace:HandyControl.Tools.Extension" xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:interactivity="clr-namespace:HandyControl.Interactivity" xmlns:langs="clr-namespace:HandyControl.Properties.Langs">
  2. <Style x:Key="Tag4CheckComboBoxStyle" BasedOn="{StaticResource TagBaseStyle}" TargetType="hc:Tag">
  3. <Setter Property="Padding" Value="6,2,4,2" />
  4. <Setter Property="Height" Value="Auto" />
  5. <Setter Property="Template">
  6. <Setter.Value>
  7. <ControlTemplate TargetType="hc:Tag">
  8. <Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
  9. <Grid>
  10. <Grid.ColumnDefinitions>
  11. <ColumnDefinition />
  12. <ColumnDefinition Width="Auto" />
  13. </Grid.ColumnDefinitions>
  14. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  15. <Button Focusable="False" Name="ButtonClose" Visibility="{TemplateBinding ShowCloseButton,Converter={StaticResource Boolean2VisibilityConverter}}" Command="interactivity:ControlCommands.Close" Margin="10,0,0,0" Width="16" Height="16" Padding="0,4" Grid.Column="1" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" Foreground="{TemplateBinding Foreground}" />
  16. </Grid>
  17. </Border>
  18. <ControlTemplate.Triggers>
  19. <Trigger Property="IsMouseOver" Value="True" SourceName="ButtonClose">
  20. <Setter Property="hc:IconElement.Geometry" Value="{StaticResource DeleteFillCircleGeometry}" TargetName="ButtonClose" />
  21. <Setter Property="Padding" Value="0" TargetName="ButtonClose" />
  22. </Trigger>
  23. </ControlTemplate.Triggers>
  24. </ControlTemplate>
  25. </Setter.Value>
  26. </Setter>
  27. </Style>
  28. <Style x:Key="CheckComboBoxItemBaseStyle" TargetType="hc:CheckComboBoxItem">
  29. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  30. <Setter Property="VerticalContentAlignment" Value="Center" />
  31. <Setter Property="SnapsToDevicePixels" Value="True" />
  32. <Setter Property="Padding" Value="{StaticResource DefaultControlPadding}" />
  33. <Setter Property="Background" Value="Transparent" />
  34. <Setter Property="BorderBrush" Value="Transparent" />
  35. <Setter Property="BorderThickness" Value="0" />
  36. <Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
  37. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  38. <Setter Property="Template">
  39. <Setter.Value>
  40. <ControlTemplate TargetType="hc:CheckComboBoxItem">
  41. <Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{Binding Padding,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource ThicknessSplitConverter},ConverterParameter='1,0,1,0'}" SnapsToDevicePixels="true">
  42. <CheckBox Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Stretch" MinHeight="{TemplateBinding MinHeight}" FocusVisualStyle="{x:Null}" IsChecked="{Binding IsSelected,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}">
  43. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  44. </CheckBox>
  45. </Border>
  46. <ControlTemplate.Triggers>
  47. <Trigger Property="IsMouseOver" Value="True">
  48. <Setter Property="Background" TargetName="Bd" Value="{DynamicResource SecondaryRegionBrush}" />
  49. </Trigger>
  50. </ControlTemplate.Triggers>
  51. </ControlTemplate>
  52. </Setter.Value>
  53. </Setter>
  54. </Style>
  55. <ControlTemplate x:Key="CheckComboBoxTemplate" TargetType="hc:CheckComboBox">
  56. <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
  57. <Grid.ColumnDefinitions>
  58. <ColumnDefinition />
  59. <ColumnDefinition Width="Auto" />
  60. </Grid.ColumnDefinitions>
  61. <Border x:Name="border" Grid.ColumnSpan="2" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
  62. <ToggleButton ClickMode="Release" BorderThickness="0" Grid.Column="1" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Height="Auto" Width="Auto" HorizontalContentAlignment="Left" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" hc:IconElement.Width="14" Style="{StaticResource ToggleButtonIconTransparent}" Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" hc:IconSwitchElement.Geometry="{StaticResource DownGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" Foreground="{TemplateBinding BorderBrush}" Focusable="False" />
  63. <Border Grid.Column="0" Margin="-4 0">
  64. <hc:UniformSpacingPanel x:Name="PART_Panel" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Spacing="{TemplateBinding TagSpacing}" ChildWrapping="Wrap" ItemVerticalAlignment="Center" />
  65. </Border>
  66. <Popup x:Name="PART_Popup" StaysOpen="False" PlacementTarget="{Binding ElementName=border}" IsOpen="{Binding IsDropDownOpen,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" AllowsTransparency="true" Grid.ColumnSpan="2" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
  67. <Decorator Margin="8 0">
  68. <Border Effect="{StaticResource EffectShadow2}" BorderThickness="0,1,0,0" Margin="0,0,0,8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MinWidth="{Binding ActualWidth, ElementName=border}" MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
  69. <hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
  70. <hc:ToggleBlock.CheckedContent>
  71. <Grid Margin="2" ClipToBounds="False">
  72. <Grid.RowDefinitions>
  73. <RowDefinition Height="Auto" />
  74. <RowDefinition />
  75. </Grid.RowDefinitions>
  76. <hc:CheckComboBoxItem x:Name="PART_SelectAll" Style="{TemplateBinding ItemContainerStyle}" IsEnabled="{TemplateBinding ShowSelectAllButton}" Visibility="{Binding ShowSelectAllButton,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalContentAlignment="Stretch" Content="{ex:Lang Key={x:Static langs:LangKeys.All}}" />
  77. <ScrollViewer x:Name="DropDownScrollViewer" Grid.Row="1">
  78. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  79. </ScrollViewer>
  80. </Grid>
  81. </hc:ToggleBlock.CheckedContent>
  82. <hc:ToggleBlock.UnCheckedContent>
  83. <hc:Empty />
  84. </hc:ToggleBlock.UnCheckedContent>
  85. </hc:ToggleBlock>
  86. </Border>
  87. </Decorator>
  88. </Popup>
  89. </Grid>
  90. <ControlTemplate.Triggers>
  91. <Trigger Property="HasItems" Value="false">
  92. <Setter Property="Height" TargetName="dropDownBorder" Value="95" />
  93. </Trigger>
  94. <Trigger Property="hc:DropDownElement.ConsistentWidth" Value="True">
  95. <Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=border}" />
  96. <Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=border}" />
  97. </Trigger>
  98. <MultiTrigger>
  99. <MultiTrigger.Conditions>
  100. <Condition Property="IsGrouping" Value="true" />
  101. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  102. </MultiTrigger.Conditions>
  103. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  104. </MultiTrigger>
  105. <MultiTrigger>
  106. <MultiTrigger.Conditions>
  107. <Condition Property="IsMouseOver" Value="true" />
  108. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup" />
  109. </MultiTrigger.Conditions>
  110. <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
  111. </MultiTrigger>
  112. <Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
  113. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  114. </Trigger>
  115. <Trigger Property="IsFocused" Value="True">
  116. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  117. </Trigger>
  118. <Trigger Property="IsEnabled" Value="false">
  119. <Setter Property="Opacity" Value="0.4" />
  120. </Trigger>
  121. </ControlTemplate.Triggers>
  122. </ControlTemplate>
  123. <Style x:Key="CheckComboBoxBaseStyle" BasedOn="{StaticResource InputElementBaseStyle}" TargetType="hc:CheckComboBox">
  124. <Setter Property="TagStyle" Value="{StaticResource Tag4CheckComboBoxStyle}" />
  125. <Setter Property="TagSpacing" Value="4" />
  126. <Setter Property="SelectionMode" Value="Multiple" />
  127. <Setter Property="ItemContainerStyle" Value="{StaticResource CheckComboBoxItemBaseStyle}" />
  128. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
  129. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
  130. <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
  131. <Setter Property="ScrollViewer.PanningMode" Value="Both" />
  132. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  133. <Setter Property="Padding" Value="8,4" />
  134. <Setter Property="Template" Value="{StaticResource CheckComboBoxTemplate}" />
  135. </Style>
  136. <ControlTemplate x:Key="CheckComboBoxExtendTopTemplate" TargetType="hc:CheckComboBox">
  137. <Grid>
  138. <Grid.RowDefinitions>
  139. <RowDefinition Height="Auto" />
  140. <RowDefinition MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight),RelativeSource={RelativeSource TemplatedParent}}" Height="{Binding Path=(hc:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Double2GridLengthConverter}}" />
  141. </Grid.RowDefinitions>
  142. <DockPanel LastChildFill="True" Visibility="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" HorizontalAlignment="{Binding Path=(hc:TitleElement.HorizontalAlignment),RelativeSource={RelativeSource TemplatedParent}}" Margin="{Binding Path=(hc:TitleElement.MarginOnTheTop),RelativeSource={RelativeSource TemplatedParent}}">
  143. <ContentPresenter DockPanel.Dock="Right" TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(hc:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(hc:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" />
  144. <TextBlock hc:TextBlockAttach.AutoTooltip="True" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Text="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}" />
  145. </DockPanel>
  146. <Grid x:Name="contentPanel" Grid.Row="1">
  147. <Grid.ColumnDefinitions>
  148. <ColumnDefinition />
  149. <ColumnDefinition Width="Auto" />
  150. </Grid.ColumnDefinitions>
  151. <Border x:Name="border" Grid.ColumnSpan="2" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
  152. <TextBlock Grid.Column="0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="{Binding SelectedItem,RelativeSource={RelativeSource AncestorType=hc:CheckComboBox},Converter={StaticResource Object2VisibilityReConverter}}" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(hc:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}" />
  153. <ToggleButton ClickMode="Release" BorderThickness="0" Grid.Column="1" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Height="Auto" Width="Auto" HorizontalContentAlignment="Left" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" hc:IconElement.Width="14" Style="{StaticResource ToggleButtonIconTransparent}" Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" hc:IconSwitchElement.Geometry="{StaticResource DownGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" Foreground="{TemplateBinding BorderBrush}" Focusable="False" />
  154. <Border Grid.Column="0" Margin="-4 0">
  155. <hc:UniformSpacingPanel x:Name="PART_Panel" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Spacing="{TemplateBinding TagSpacing}" ChildWrapping="Wrap" ItemVerticalAlignment="Center" />
  156. </Border>
  157. <Popup x:Name="PART_Popup" StaysOpen="False" PlacementTarget="{Binding ElementName=border}" AllowsTransparency="true" IsOpen="{Binding IsDropDownOpen,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" Margin="1" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
  158. <Decorator Margin="8 0">
  159. <Border Effect="{StaticResource EffectShadow2}" BorderThickness="0,1,0,0" Margin="0,0,0,8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MinWidth="{Binding ActualWidth, ElementName=border}" MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
  160. <hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
  161. <hc:ToggleBlock.CheckedContent>
  162. <Grid Margin="2" ClipToBounds="False">
  163. <Grid.RowDefinitions>
  164. <RowDefinition Height="Auto" />
  165. <RowDefinition />
  166. </Grid.RowDefinitions>
  167. <hc:CheckComboBoxItem x:Name="PART_SelectAll" Style="{TemplateBinding ItemContainerStyle}" IsEnabled="{TemplateBinding ShowSelectAllButton}" Visibility="{Binding ShowSelectAllButton,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalContentAlignment="Stretch" Content="{ex:Lang Key={x:Static langs:LangKeys.All}}" />
  168. <ScrollViewer x:Name="DropDownScrollViewer" Grid.Row="1">
  169. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  170. </ScrollViewer>
  171. </Grid>
  172. </hc:ToggleBlock.CheckedContent>
  173. <hc:ToggleBlock.UnCheckedContent>
  174. <hc:Empty />
  175. </hc:ToggleBlock.UnCheckedContent>
  176. </hc:ToggleBlock>
  177. </Border>
  178. </Decorator>
  179. </Popup>
  180. </Grid>
  181. </Grid>
  182. <ControlTemplate.Triggers>
  183. <Trigger Property="HasItems" Value="false">
  184. <Setter Property="Height" TargetName="dropDownBorder" Value="95" />
  185. </Trigger>
  186. <Trigger Property="hc:DropDownElement.ConsistentWidth" Value="True">
  187. <Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=border}" />
  188. <Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=border}" />
  189. </Trigger>
  190. <MultiTrigger>
  191. <MultiTrigger.Conditions>
  192. <Condition Property="IsGrouping" Value="true" />
  193. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  194. </MultiTrigger.Conditions>
  195. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  196. </MultiTrigger>
  197. <MultiTrigger>
  198. <MultiTrigger.Conditions>
  199. <Condition Property="IsMouseOver" Value="true" SourceName="contentPanel" />
  200. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup" />
  201. </MultiTrigger.Conditions>
  202. <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
  203. </MultiTrigger>
  204. <Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
  205. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  206. </Trigger>
  207. <Trigger Property="IsFocused" Value="True">
  208. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  209. </Trigger>
  210. <Trigger Property="IsEnabled" Value="false">
  211. <Setter Property="Opacity" Value="0.4" TargetName="contentPanel" />
  212. </Trigger>
  213. </ControlTemplate.Triggers>
  214. </ControlTemplate>
  215. <ControlTemplate x:Key="CheckComboBoxExtendLeftTemplate" TargetType="hc:CheckComboBox">
  216. <Grid x:Name="templateRoot" SnapsToDevicePixels="true" MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight),RelativeSource={RelativeSource TemplatedParent}}" Height="{Binding Path=(hc:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}">
  217. <Grid.ColumnDefinitions>
  218. <ColumnDefinition Width="{Binding Path=(hc:InfoElement.TitleWidth),RelativeSource={RelativeSource TemplatedParent}}" />
  219. <ColumnDefinition />
  220. </Grid.ColumnDefinitions>
  221. <DockPanel LastChildFill="True" Visibility="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" HorizontalAlignment="{Binding Path=(hc:TitleElement.HorizontalAlignment),RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="{Binding Path=(hc:TitleElement.VerticalAlignment),RelativeSource={RelativeSource TemplatedParent}}" Margin="{Binding Path=(hc:TitleElement.MarginOnTheLeft),RelativeSource={RelativeSource TemplatedParent}}">
  222. <ContentPresenter DockPanel.Dock="Right" TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(hc:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(hc:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" />
  223. <TextBlock hc:TextBlockAttach.AutoTooltip="True" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Text="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}" />
  224. </DockPanel>
  225. <Grid x:Name="contentPanel" Grid.Column="1">
  226. <Grid.ColumnDefinitions>
  227. <ColumnDefinition />
  228. <ColumnDefinition Width="Auto" />
  229. </Grid.ColumnDefinitions>
  230. <Border x:Name="border" Grid.ColumnSpan="2" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
  231. <TextBlock Grid.Column="0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="{Binding SelectedItem,RelativeSource={RelativeSource AncestorType=hc:CheckComboBox},Converter={StaticResource Object2VisibilityReConverter}}" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(hc:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}" />
  232. <ToggleButton ClickMode="Release" BorderThickness="0" Grid.Column="1" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Height="Auto" Width="Auto" HorizontalContentAlignment="Left" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" hc:IconElement.Width="14" Style="{StaticResource ToggleButtonIconTransparent}" Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" hc:IconSwitchElement.Geometry="{StaticResource DownGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" Foreground="{TemplateBinding BorderBrush}" Focusable="False" />
  233. <Border Grid.Column="0" Margin="-4 0">
  234. <hc:UniformSpacingPanel x:Name="PART_Panel" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Spacing="{TemplateBinding TagSpacing}" ChildWrapping="Wrap" ItemVerticalAlignment="Center" />
  235. </Border>
  236. <Popup x:Name="PART_Popup" StaysOpen="False" PlacementTarget="{Binding ElementName=border}" AllowsTransparency="true" IsOpen="{Binding IsDropDownOpen,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" Margin="1" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
  237. <Decorator Margin="8 0">
  238. <Border Effect="{StaticResource EffectShadow2}" BorderThickness="0,1,0,0" Margin="0,0,0,8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MinWidth="{Binding ActualWidth, ElementName=border}" MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
  239. <hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
  240. <hc:ToggleBlock.CheckedContent>
  241. <Grid Margin="2" ClipToBounds="False">
  242. <Grid.RowDefinitions>
  243. <RowDefinition Height="Auto" />
  244. <RowDefinition />
  245. </Grid.RowDefinitions>
  246. <hc:CheckComboBoxItem x:Name="PART_SelectAll" Style="{TemplateBinding ItemContainerStyle}" IsEnabled="{TemplateBinding ShowSelectAllButton}" Visibility="{Binding ShowSelectAllButton,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalContentAlignment="Stretch" Content="{ex:Lang Key={x:Static langs:LangKeys.All}}" />
  247. <ScrollViewer x:Name="DropDownScrollViewer" Grid.Row="1">
  248. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  249. </ScrollViewer>
  250. </Grid>
  251. </hc:ToggleBlock.CheckedContent>
  252. <hc:ToggleBlock.UnCheckedContent>
  253. <hc:Empty />
  254. </hc:ToggleBlock.UnCheckedContent>
  255. </hc:ToggleBlock>
  256. </Border>
  257. </Decorator>
  258. </Popup>
  259. </Grid>
  260. </Grid>
  261. <ControlTemplate.Triggers>
  262. <Trigger Property="HasItems" Value="false">
  263. <Setter Property="Height" TargetName="dropDownBorder" Value="95" />
  264. </Trigger>
  265. <Trigger Property="hc:DropDownElement.ConsistentWidth" Value="True">
  266. <Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=border}" />
  267. <Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=border}" />
  268. </Trigger>
  269. <MultiTrigger>
  270. <MultiTrigger.Conditions>
  271. <Condition Property="IsGrouping" Value="true" />
  272. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  273. </MultiTrigger.Conditions>
  274. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  275. </MultiTrigger>
  276. <MultiTrigger>
  277. <MultiTrigger.Conditions>
  278. <Condition Property="IsMouseOver" Value="true" SourceName="contentPanel" />
  279. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup" />
  280. </MultiTrigger.Conditions>
  281. <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
  282. </MultiTrigger>
  283. <Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
  284. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  285. </Trigger>
  286. <Trigger Property="IsFocused" Value="True">
  287. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  288. </Trigger>
  289. <Trigger Property="IsEnabled" Value="false">
  290. <Setter Property="Opacity" Value="0.4" TargetName="contentPanel" />
  291. </Trigger>
  292. </ControlTemplate.Triggers>
  293. </ControlTemplate>
  294. <Style x:Key="CheckComboBoxExtendBaseStyle" BasedOn="{StaticResource CheckComboBoxBaseStyle}" TargetType="hc:CheckComboBox">
  295. <Setter Property="Height" Value="Auto" />
  296. <Setter Property="Template" Value="{StaticResource CheckComboBoxExtendTopTemplate}" />
  297. <Setter Property="hc:InfoElement.Symbol" Value="●" />
  298. <Setter Property="hc:InfoElement.ContentHeight" Value="{x:Static system:Double.NaN}" />
  299. <Setter Property="hc:InfoElement.MinContentHeight" Value="{StaticResource DefaultControlHeight}" />
  300. <Style.Triggers>
  301. <Trigger Property="hc:InfoElement.TitlePlacement" Value="Left">
  302. <Setter Property="Template" Value="{StaticResource CheckComboBoxExtendLeftTemplate}" />
  303. </Trigger>
  304. </Style.Triggers>
  305. </Style>
  306. <ControlTemplate x:Key="CheckComboBoxPlusTopTemplate" TargetType="hc:CheckComboBox">
  307. <Grid>
  308. <Grid.RowDefinitions>
  309. <RowDefinition Height="Auto" />
  310. <RowDefinition MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight),RelativeSource={RelativeSource TemplatedParent}}" Height="{Binding Path=(hc:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Double2GridLengthConverter}}" />
  311. </Grid.RowDefinitions>
  312. <DockPanel Grid.ColumnSpan="2" LastChildFill="True" Visibility="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" HorizontalAlignment="{Binding Path=(hc:TitleElement.HorizontalAlignment),RelativeSource={RelativeSource TemplatedParent}}" Margin="{Binding Path=(hc:TitleElement.MarginOnTheTop),RelativeSource={RelativeSource TemplatedParent}}">
  313. <ContentPresenter DockPanel.Dock="Right" TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(hc:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(hc:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" />
  314. <TextBlock hc:TextBlockAttach.AutoTooltip="True" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Text="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}" />
  315. </DockPanel>
  316. <Grid x:Name="contentPanel" Grid.Row="1">
  317. <Grid.ColumnDefinitions>
  318. <ColumnDefinition />
  319. <ColumnDefinition Width="Auto" />
  320. <ColumnDefinition Width="Auto" />
  321. </Grid.ColumnDefinitions>
  322. <Border x:Name="border" Grid.ColumnSpan="3" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
  323. <TextBlock Grid.Column="0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="{Binding SelectedItem,RelativeSource={RelativeSource AncestorType=hc:CheckComboBox},Converter={StaticResource Object2VisibilityReConverter}}" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(hc:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}" />
  324. <ToggleButton ClickMode="Release" BorderThickness="0" Grid.Column="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Height="Auto" Width="Auto" HorizontalContentAlignment="Left" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" hc:IconElement.Width="14" Style="{StaticResource ToggleButtonIconTransparent}" Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" hc:IconSwitchElement.Geometry="{StaticResource DownGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" Foreground="{TemplateBinding BorderBrush}" Focusable="False" />
  325. <Border Grid.Column="0" Margin="-4 0">
  326. <hc:UniformSpacingPanel x:Name="PART_Panel" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Spacing="{TemplateBinding TagSpacing}" ChildWrapping="Wrap" ItemVerticalAlignment="Center" />
  327. </Border>
  328. <Button Height="Auto" Width="Auto" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" hc:IconElement.Width="14" Command="interactivity:ControlCommands.Clear" Visibility="Hidden" Name="ButtonClear" Grid.Column="1" Style="{StaticResource ButtonIcon}" Padding="0,0,4,0" hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Foreground="{Binding BorderBrush,ElementName=border}" />
  329. <Popup x:Name="PART_Popup" StaysOpen="False" PlacementTarget="{Binding ElementName=border}" AllowsTransparency="true" IsOpen="{Binding IsDropDownOpen,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" Margin="1" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
  330. <Decorator Margin="8 0">
  331. <Border Effect="{StaticResource EffectShadow2}" BorderThickness="0,1,0,0" Margin="0,0,0,8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MinWidth="{Binding ActualWidth, ElementName=border}" MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
  332. <hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
  333. <hc:ToggleBlock.CheckedContent>
  334. <Grid Margin="2" ClipToBounds="False">
  335. <Grid.RowDefinitions>
  336. <RowDefinition Height="Auto" />
  337. <RowDefinition />
  338. </Grid.RowDefinitions>
  339. <hc:CheckComboBoxItem x:Name="PART_SelectAll" Style="{TemplateBinding ItemContainerStyle}" IsEnabled="{TemplateBinding ShowSelectAllButton}" Visibility="{Binding ShowSelectAllButton,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalContentAlignment="Stretch" Content="{ex:Lang Key={x:Static langs:LangKeys.All}}" />
  340. <ScrollViewer x:Name="DropDownScrollViewer" Grid.Row="1">
  341. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  342. </ScrollViewer>
  343. </Grid>
  344. </hc:ToggleBlock.CheckedContent>
  345. <hc:ToggleBlock.UnCheckedContent>
  346. <hc:Empty />
  347. </hc:ToggleBlock.UnCheckedContent>
  348. </hc:ToggleBlock>
  349. </Border>
  350. </Decorator>
  351. </Popup>
  352. </Grid>
  353. </Grid>
  354. <ControlTemplate.Triggers>
  355. <Trigger Property="HasItems" Value="false">
  356. <Setter Property="Height" TargetName="dropDownBorder" Value="95" />
  357. </Trigger>
  358. <Trigger Property="hc:DropDownElement.ConsistentWidth" Value="True">
  359. <Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=border}" />
  360. <Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=border}" />
  361. </Trigger>
  362. <MultiTrigger>
  363. <MultiTrigger.Conditions>
  364. <Condition Property="IsGrouping" Value="true" />
  365. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  366. </MultiTrigger.Conditions>
  367. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  368. </MultiTrigger>
  369. <MultiTrigger>
  370. <MultiTrigger.Conditions>
  371. <Condition Property="IsMouseOver" Value="true" SourceName="contentPanel" />
  372. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup" />
  373. </MultiTrigger.Conditions>
  374. <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
  375. </MultiTrigger>
  376. <MultiTrigger>
  377. <MultiTrigger.Conditions>
  378. <Condition Property="IsMouseOver" Value="true" SourceName="ButtonClear" />
  379. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup" />
  380. </MultiTrigger.Conditions>
  381. <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
  382. </MultiTrigger>
  383. <MultiTrigger>
  384. <MultiTrigger.Conditions>
  385. <Condition Property="IsMouseOver" Value="true" SourceName="contentPanel" />
  386. <Condition Property="hc:InfoElement.ShowClearButton" Value="True" />
  387. </MultiTrigger.Conditions>
  388. <Setter Property="Visibility" Value="Visible" TargetName="ButtonClear" />
  389. </MultiTrigger>
  390. <MultiTrigger>
  391. <MultiTrigger.Conditions>
  392. <Condition Property="IsMouseOver" Value="true" SourceName="ButtonClear" />
  393. <Condition Property="hc:InfoElement.ShowClearButton" Value="True" />
  394. </MultiTrigger.Conditions>
  395. <Setter Property="Visibility" Value="Visible" TargetName="ButtonClear" />
  396. </MultiTrigger>
  397. <Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
  398. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  399. </Trigger>
  400. <Trigger Property="IsFocused" Value="True">
  401. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  402. </Trigger>
  403. <Trigger Property="IsEnabled" Value="false">
  404. <Setter Property="Opacity" Value="0.4" TargetName="contentPanel" />
  405. </Trigger>
  406. </ControlTemplate.Triggers>
  407. </ControlTemplate>
  408. <ControlTemplate x:Key="CheckComboBoxPlusLeftTemplate" TargetType="hc:CheckComboBox">
  409. <Grid x:Name="templateRoot" SnapsToDevicePixels="true" MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight),RelativeSource={RelativeSource TemplatedParent}}" Height="{Binding Path=(hc:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}">
  410. <Grid.ColumnDefinitions>
  411. <ColumnDefinition Width="{Binding Path=(hc:InfoElement.TitleWidth),RelativeSource={RelativeSource TemplatedParent}}" />
  412. <ColumnDefinition />
  413. </Grid.ColumnDefinitions>
  414. <DockPanel LastChildFill="True" Visibility="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource String2VisibilityConverter}}" HorizontalAlignment="{Binding Path=(hc:TitleElement.HorizontalAlignment),RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="{Binding Path=(hc:TitleElement.VerticalAlignment),RelativeSource={RelativeSource TemplatedParent}}" Margin="{Binding Path=(hc:TitleElement.MarginOnTheLeft),RelativeSource={RelativeSource TemplatedParent}}">
  415. <ContentPresenter DockPanel.Dock="Right" TextElement.Foreground="{DynamicResource DangerBrush}" Margin="4,0,0,0" Content="{Binding Path=(hc:InfoElement.Symbol),RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding Path=(hc:InfoElement.Necessary),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" />
  416. <TextBlock hc:TextBlockAttach.AutoTooltip="True" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Text="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}" />
  417. </DockPanel>
  418. <Grid x:Name="contentPanel" Grid.Column="1">
  419. <Grid.ColumnDefinitions>
  420. <ColumnDefinition />
  421. <ColumnDefinition Width="Auto" />
  422. <ColumnDefinition Width="Auto" />
  423. </Grid.ColumnDefinitions>
  424. <Border x:Name="border" Grid.ColumnSpan="3" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
  425. <TextBlock Grid.Column="0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="{Binding SelectedItem,RelativeSource={RelativeSource AncestorType=hc:CheckComboBox},Converter={StaticResource Object2VisibilityReConverter}}" HorizontalAlignment="Stretch" Style="{StaticResource TextBlockDefaultThiLight}" Text="{Binding Path=(hc:InfoElement.Placeholder),RelativeSource={RelativeSource TemplatedParent}}" />
  426. <ToggleButton ClickMode="Release" BorderThickness="0" Grid.Column="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Height="Auto" Width="Auto" HorizontalContentAlignment="Left" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" hc:IconElement.Width="14" Style="{StaticResource ToggleButtonIconTransparent}" Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" hc:IconSwitchElement.Geometry="{StaticResource DownGeometry}" hc:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}" Foreground="{TemplateBinding BorderBrush}" Focusable="False" />
  427. <Border Grid.Column="0" Margin="-4 0">
  428. <hc:UniformSpacingPanel x:Name="PART_Panel" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Spacing="{TemplateBinding TagSpacing}" ChildWrapping="Wrap" ItemVerticalAlignment="Center" />
  429. </Border>
  430. <Button Height="Auto" Width="Auto" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" hc:IconElement.Width="14" Command="interactivity:ControlCommands.Clear" Visibility="Hidden" Name="ButtonClear" Grid.Column="1" Style="{StaticResource ButtonIcon}" Padding="0,0,4,0" hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Foreground="{Binding BorderBrush,ElementName=border}" />
  431. <Popup x:Name="PART_Popup" StaysOpen="False" PlacementTarget="{Binding ElementName=border}" AllowsTransparency="true" IsOpen="{Binding IsDropDownOpen,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}" Margin="1" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
  432. <Decorator Margin="8 0">
  433. <Border Effect="{StaticResource EffectShadow2}" BorderThickness="0,1,0,0" Margin="0,0,0,8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MinWidth="{Binding ActualWidth, ElementName=border}" MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
  434. <hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
  435. <hc:ToggleBlock.CheckedContent>
  436. <Grid Margin="2" ClipToBounds="False">
  437. <Grid.RowDefinitions>
  438. <RowDefinition Height="Auto" />
  439. <RowDefinition />
  440. </Grid.RowDefinitions>
  441. <hc:CheckComboBoxItem x:Name="PART_SelectAll" Style="{TemplateBinding ItemContainerStyle}" IsEnabled="{TemplateBinding ShowSelectAllButton}" Visibility="{Binding ShowSelectAllButton,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalContentAlignment="Stretch" Content="{ex:Lang Key={x:Static langs:LangKeys.All}}" />
  442. <ScrollViewer x:Name="DropDownScrollViewer" Grid.Row="1">
  443. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  444. </ScrollViewer>
  445. </Grid>
  446. </hc:ToggleBlock.CheckedContent>
  447. <hc:ToggleBlock.UnCheckedContent>
  448. <hc:Empty />
  449. </hc:ToggleBlock.UnCheckedContent>
  450. </hc:ToggleBlock>
  451. </Border>
  452. </Decorator>
  453. </Popup>
  454. </Grid>
  455. </Grid>
  456. <ControlTemplate.Triggers>
  457. <Trigger Property="HasItems" Value="false">
  458. <Setter Property="Height" TargetName="dropDownBorder" Value="95" />
  459. </Trigger>
  460. <Trigger Property="hc:DropDownElement.ConsistentWidth" Value="True">
  461. <Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=border}" />
  462. <Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=border}" />
  463. </Trigger>
  464. <MultiTrigger>
  465. <MultiTrigger.Conditions>
  466. <Condition Property="IsGrouping" Value="true" />
  467. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  468. </MultiTrigger.Conditions>
  469. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  470. </MultiTrigger>
  471. <MultiTrigger>
  472. <MultiTrigger.Conditions>
  473. <Condition Property="IsMouseOver" Value="true" SourceName="contentPanel" />
  474. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup" />
  475. </MultiTrigger.Conditions>
  476. <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
  477. </MultiTrigger>
  478. <MultiTrigger>
  479. <MultiTrigger.Conditions>
  480. <Condition Property="IsMouseOver" Value="true" SourceName="ButtonClear" />
  481. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup" />
  482. </MultiTrigger.Conditions>
  483. <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
  484. </MultiTrigger>
  485. <MultiTrigger>
  486. <MultiTrigger.Conditions>
  487. <Condition Property="IsMouseOver" Value="true" SourceName="contentPanel" />
  488. <Condition Property="hc:InfoElement.ShowClearButton" Value="True" />
  489. </MultiTrigger.Conditions>
  490. <Setter Property="Visibility" Value="Visible" TargetName="ButtonClear" />
  491. </MultiTrigger>
  492. <MultiTrigger>
  493. <MultiTrigger.Conditions>
  494. <Condition Property="IsMouseOver" Value="true" SourceName="ButtonClear" />
  495. <Condition Property="hc:InfoElement.ShowClearButton" Value="True" />
  496. </MultiTrigger.Conditions>
  497. <Setter Property="Visibility" Value="Visible" TargetName="ButtonClear" />
  498. </MultiTrigger>
  499. <Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
  500. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  501. </Trigger>
  502. <Trigger Property="IsFocused" Value="True">
  503. <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
  504. </Trigger>
  505. <Trigger Property="IsEnabled" Value="false">
  506. <Setter Property="Opacity" Value="0.4" TargetName="contentPanel" />
  507. </Trigger>
  508. </ControlTemplate.Triggers>
  509. </ControlTemplate>
  510. <Style x:Key="CheckComboBoxPlusBaseStyle" BasedOn="{StaticResource CheckComboBoxExtendBaseStyle}" TargetType="hc:CheckComboBox">
  511. <Setter Property="Template" Value="{StaticResource CheckComboBoxPlusTopTemplate}" />
  512. <Style.Triggers>
  513. <Trigger Property="hc:InfoElement.TitlePlacement" Value="Left">
  514. <Setter Property="Template" Value="{StaticResource CheckComboBoxPlusLeftTemplate}" />
  515. </Trigger>
  516. </Style.Triggers>
  517. </Style>
  518. </ResourceDictionary>