DatePickerBaseStyle.xaml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:hc="clr-namespace:HandyControl.Controls"
  4. xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
  5. xmlns:system="clr-namespace:System;assembly=mscorlib">
  6. <Style x:Key="DatePickerTextBoxStyle" TargetType="DatePickerTextBox">
  7. <Setter Property="Foreground" Value="{Binding Foreground,RelativeSource={RelativeSource AncestorType=DatePicker}}"/>
  8. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  9. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  10. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  11. <Setter Property="CaretBrush" Value="{DynamicResource PrimaryTextBrush}"/>
  12. <Setter Property="Template">
  13. <Setter.Value>
  14. <ControlTemplate TargetType="DatePickerTextBox">
  15. <hc:SimplePanel>
  16. <TextBlock VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" Text="{Binding Path=(hc:InfoElement.Placeholder),RelativeSource={RelativeSource AncestorType=DatePicker}}" TextElement.Foreground="{DynamicResource ThirdlyTextBrush}" Visibility="{TemplateBinding Text,Converter={StaticResource String2VisibilityReConverter}}"/>
  17. <ScrollViewer Margin="-2,0" Padding="{TemplateBinding Padding}" x:Name="PART_ContentHost" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
  18. </hc:SimplePanel>
  19. </ControlTemplate>
  20. </Setter.Value>
  21. </Setter>
  22. </Style>
  23. <Style x:Key="DatePickerBaseStyle" BasedOn="{StaticResource InputElementBaseStyle}" TargetType="DatePicker">
  24. <Setter Property="CalendarStyle" Value="{StaticResource CalendarBaseStyle}"/>
  25. <Setter Property="IsTodayHighlighted" Value="True"/>
  26. <Setter Property="SelectedDateFormat" Value="Short"/>
  27. <Setter Property="Template">
  28. <Setter.Value>
  29. <ControlTemplate TargetType="DatePicker">
  30. <Grid x:Name="PART_Root">
  31. <Grid.ColumnDefinitions>
  32. <ColumnDefinition />
  33. <ColumnDefinition Width="Auto" />
  34. </Grid.ColumnDefinitions>
  35. <Border x:Name="border" Grid.ColumnSpan="2" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
  36. <Button Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" hc:IconElement.Width="14" Style="{StaticResource ButtonIcon}" Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" x:Name="PART_Button" Grid.Column="1" Foreground="{Binding BorderBrush,ElementName=border}" Focusable="False" Grid.Row="0" />
  37. <DatePickerTextBox Padding="{TemplateBinding Padding}" x:Name="PART_TextBox" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Grid.Row="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Style="{StaticResource DatePickerTextBoxStyle}" />
  38. <Popup Grid.Column="0" x:Name="PART_Popup" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" AllowsTransparency="True" Placement="Bottom" PlacementTarget="{Binding ElementName=border}" StaysOpen="False" />
  39. </Grid>
  40. <ControlTemplate.Triggers>
  41. <Trigger Property="hc:InfoElement.IsReadOnly" Value="True">
  42. <Setter TargetName="PART_Button" Property="IsEnabled" Value="False" />
  43. <Setter TargetName="PART_Button" Property="Visibility" Value="Collapsed" />
  44. <Setter TargetName="PART_TextBox" Property="IsReadOnly" Value="True" />
  45. </Trigger>
  46. <Trigger Property="IsEnabled" Value="false">
  47. <Setter Property="Opacity" TargetName="PART_Root" Value="0.4"/>
  48. </Trigger>
  49. <MultiTrigger>
  50. <MultiTrigger.Conditions>
  51. <Condition Property="IsMouseOver" Value="true"/>
  52. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup"/>
  53. </MultiTrigger.Conditions>
  54. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SecondaryBorderBrush}"/>
  55. </MultiTrigger>
  56. <MultiTrigger>
  57. <MultiTrigger.Conditions>
  58. <Condition Property="IsMouseOver" Value="true"/>
  59. <Condition Property="IsOpen" Value="true" SourceName="PART_Popup"/>
  60. </MultiTrigger.Conditions>
  61. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  62. </MultiTrigger>
  63. <Trigger Property="IsFocused" Value="true" SourceName="PART_TextBox">
  64. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  65. </Trigger>
  66. <Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
  67. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  68. </Trigger>
  69. </ControlTemplate.Triggers>
  70. </ControlTemplate>
  71. </Setter.Value>
  72. </Setter>
  73. </Style>
  74. <ControlTemplate x:Key="DatePickerExtendTopTemplate" TargetType="DatePicker">
  75. <Grid>
  76. <Grid.RowDefinitions>
  77. <RowDefinition Height="Auto"/>
  78. <RowDefinition MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight),RelativeSource={RelativeSource TemplatedParent}}" Height="{Binding Path=(hc:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Double2GridLengthConverter}}"/>
  79. </Grid.RowDefinitions>
  80. <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}}">
  81. <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}}" />
  82. <TextBlock hc:TextBlockAttach.AutoTooltip="True" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Text="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}" />
  83. </DockPanel>
  84. <Grid x:Name="PART_Root" Grid.Row="1">
  85. <Grid.ColumnDefinitions>
  86. <ColumnDefinition />
  87. <ColumnDefinition Width="Auto" />
  88. </Grid.ColumnDefinitions>
  89. <Border x:Name="border" Grid.ColumnSpan="2" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
  90. <Button Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" hc:IconElement.Width="14" Style="{StaticResource ButtonIcon}" Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" x:Name="PART_Button" Grid.Column="1" Foreground="{Binding BorderBrush,ElementName=border}" Focusable="False" Grid.Row="0" />
  91. <DatePickerTextBox Padding="{TemplateBinding Padding}" x:Name="PART_TextBox" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Grid.Row="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Style="{StaticResource DatePickerTextBoxStyle}" />
  92. <Popup Grid.Column="0" x:Name="PART_Popup" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" AllowsTransparency="True" Placement="Bottom" PlacementTarget="{Binding ElementName=border}" StaysOpen="False" />
  93. </Grid>
  94. </Grid>
  95. <ControlTemplate.Triggers>
  96. <Trigger Property="hc:InfoElement.IsReadOnly" Value="True">
  97. <Setter TargetName="PART_Button" Property="IsEnabled" Value="False" />
  98. <Setter TargetName="PART_Button" Property="Visibility" Value="Collapsed" />
  99. <Setter TargetName="PART_TextBox" Property="IsReadOnly" Value="True" />
  100. </Trigger>
  101. <Trigger Property="IsEnabled" Value="false">
  102. <Setter Property="Opacity" TargetName="PART_Root" Value="0.4"/>
  103. </Trigger>
  104. <MultiTrigger>
  105. <MultiTrigger.Conditions>
  106. <Condition Property="IsMouseOver" Value="true" SourceName="PART_Root"/>
  107. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup"/>
  108. </MultiTrigger.Conditions>
  109. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SecondaryBorderBrush}"/>
  110. </MultiTrigger>
  111. <MultiTrigger>
  112. <MultiTrigger.Conditions>
  113. <Condition Property="IsMouseOver" Value="true" SourceName="PART_Root"/>
  114. <Condition Property="IsOpen" Value="true" SourceName="PART_Popup"/>
  115. </MultiTrigger.Conditions>
  116. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  117. </MultiTrigger>
  118. <Trigger Property="IsFocused" Value="true" SourceName="PART_TextBox">
  119. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  120. </Trigger>
  121. <Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
  122. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  123. </Trigger>
  124. </ControlTemplate.Triggers>
  125. </ControlTemplate>
  126. <ControlTemplate x:Key="DatePickerExtendLeftTemplate" TargetType="DatePicker">
  127. <Grid MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight),RelativeSource={RelativeSource TemplatedParent}}" Height="{Binding Path=(hc:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}">
  128. <Grid.ColumnDefinitions>
  129. <ColumnDefinition Width="{Binding Path=(hc:InfoElement.TitleWidth),RelativeSource={RelativeSource TemplatedParent}}"/>
  130. <ColumnDefinition/>
  131. </Grid.ColumnDefinitions>
  132. <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}}">
  133. <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}}" />
  134. <TextBlock hc:TextBlockAttach.AutoTooltip="True" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Text="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}" />
  135. </DockPanel>
  136. <Grid x:Name="PART_Root" Grid.Column="1">
  137. <Grid.ColumnDefinitions>
  138. <ColumnDefinition />
  139. <ColumnDefinition Width="Auto" />
  140. </Grid.ColumnDefinitions>
  141. <Border x:Name="border" Grid.ColumnSpan="2" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
  142. <Button Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" hc:IconElement.Width="14" Style="{StaticResource ButtonIcon}" Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" x:Name="PART_Button" Grid.Column="1" Foreground="{Binding BorderBrush,ElementName=border}" Focusable="False" Grid.Row="0" />
  143. <DatePickerTextBox Padding="{TemplateBinding Padding}" x:Name="PART_TextBox" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Grid.Row="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Style="{StaticResource DatePickerTextBoxStyle}" />
  144. <Popup Grid.Column="0" x:Name="PART_Popup" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" AllowsTransparency="True" Placement="Bottom" PlacementTarget="{Binding ElementName=border}" StaysOpen="False" />
  145. </Grid>
  146. </Grid>
  147. <ControlTemplate.Triggers>
  148. <Trigger Property="hc:InfoElement.IsReadOnly" Value="True">
  149. <Setter TargetName="PART_Button" Property="IsEnabled" Value="False" />
  150. <Setter TargetName="PART_Button" Property="Visibility" Value="Collapsed" />
  151. <Setter TargetName="PART_TextBox" Property="IsReadOnly" Value="True" />
  152. </Trigger>
  153. <Trigger Property="IsEnabled" Value="false">
  154. <Setter Property="Opacity" TargetName="PART_Root" Value="0.4"/>
  155. </Trigger>
  156. <MultiTrigger>
  157. <MultiTrigger.Conditions>
  158. <Condition Property="IsMouseOver" Value="true" SourceName="PART_Root"/>
  159. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup"/>
  160. </MultiTrigger.Conditions>
  161. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SecondaryBorderBrush}"/>
  162. </MultiTrigger>
  163. <MultiTrigger>
  164. <MultiTrigger.Conditions>
  165. <Condition Property="IsMouseOver" Value="true" SourceName="PART_Root"/>
  166. <Condition Property="IsOpen" Value="true" SourceName="PART_Popup"/>
  167. </MultiTrigger.Conditions>
  168. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  169. </MultiTrigger>
  170. <Trigger Property="IsFocused" Value="true" SourceName="PART_TextBox">
  171. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  172. </Trigger>
  173. <Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
  174. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  175. </Trigger>
  176. </ControlTemplate.Triggers>
  177. </ControlTemplate>
  178. <Style x:Key="DatePickerExtendBaseStyle" BasedOn="{StaticResource DatePickerBaseStyle}" TargetType="DatePicker">
  179. <Setter Property="Height" Value="Auto"/>
  180. <Setter Property="hc:InfoElement.Symbol" Value="●"/>
  181. <Setter Property="hc:InfoElement.ContentHeight" Value="{x:Static system:Double.NaN}"/>
  182. <Setter Property="hc:InfoElement.MinContentHeight" Value="{StaticResource DefaultControlHeight}"/>
  183. <Setter Property="Template" Value="{StaticResource DatePickerExtendTopTemplate}"/>
  184. <Style.Triggers>
  185. <Trigger Property="hc:InfoElement.TitlePlacement" Value="Left">
  186. <Setter Property="Template" Value="{StaticResource DatePickerExtendLeftTemplate}"/>
  187. <Setter Property="Width" Value="Auto"/>
  188. </Trigger>
  189. </Style.Triggers>
  190. </Style>
  191. <ControlTemplate x:Key="DatePickerPlusTopTemplate" TargetType="hc:DatePicker">
  192. <Grid>
  193. <Grid.RowDefinitions>
  194. <RowDefinition Height="Auto"/>
  195. <RowDefinition MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight),RelativeSource={RelativeSource TemplatedParent}}" Height="{Binding Path=(hc:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Double2GridLengthConverter}}"/>
  196. </Grid.RowDefinitions>
  197. <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}}">
  198. <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}}"/>
  199. <TextBlock hc:TextBlockAttach.AutoTooltip="True" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Text="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
  200. </DockPanel>
  201. <Grid x:Name="PART_Root" Grid.Row="1">
  202. <Grid.ColumnDefinitions>
  203. <ColumnDefinition />
  204. <ColumnDefinition Width="Auto" />
  205. <ColumnDefinition Width="Auto" />
  206. </Grid.ColumnDefinitions>
  207. <Border x:Name="border" Grid.ColumnSpan="3" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
  208. <Button Height="Auto" Width="Auto" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" hc:IconElement.Width="14" Command="interactivity:ControlCommands.Clear" Visibility="Collapsed" Name="ButtonClear" Grid.Column="1" Style="{StaticResource ButtonIcon}" Padding="0,0,2,0" hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Foreground="{Binding BorderBrush,ElementName=border}" />
  209. <Button Height="Auto" Width="Auto" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" hc:IconElement.Width="14" Style="{StaticResource ButtonIcon}" Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" x:Name="PART_Button" Grid.Column="2" Foreground="{Binding BorderBrush,ElementName=border}" Focusable="False" Grid.Row="0" />
  210. <DatePickerTextBox x:Name="PART_TextBox" Padding="{TemplateBinding Padding}" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Grid.Row="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Style="{StaticResource DatePickerTextBoxStyle}" />
  211. <Popup Grid.Column="0" x:Name="PART_Popup" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" AllowsTransparency="True" Placement="Bottom" PlacementTarget="{Binding ElementName=border}" StaysOpen="False" />
  212. </Grid>
  213. </Grid>
  214. <ControlTemplate.Triggers>
  215. <Trigger Property="hc:InfoElement.IsReadOnly" Value="True">
  216. <Setter TargetName="ButtonClear" Property="IsEnabled" Value="False" />
  217. <Setter TargetName="PART_Button" Property="IsEnabled" Value="False" />
  218. <Setter TargetName="PART_Button" Property="Visibility" Value="Collapsed" />
  219. <Setter TargetName="PART_TextBox" Property="IsReadOnly" Value="True" />
  220. </Trigger>
  221. <Trigger Property="IsEnabled" Value="false">
  222. <Setter Property="Opacity" TargetName="PART_Root" Value="0.4" />
  223. </Trigger>
  224. <MultiTrigger>
  225. <MultiTrigger.Conditions>
  226. <Condition Property="IsMouseOver" Value="true" SourceName="PART_Root"/>
  227. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup"/>
  228. </MultiTrigger.Conditions>
  229. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SecondaryBorderBrush}"/>
  230. </MultiTrigger>
  231. <MultiTrigger>
  232. <MultiTrigger.Conditions>
  233. <Condition Property="IsMouseOver" Value="true" SourceName="PART_Root"/>
  234. <Condition Property="IsOpen" Value="true" SourceName="PART_Popup"/>
  235. </MultiTrigger.Conditions>
  236. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  237. </MultiTrigger>
  238. <MultiTrigger>
  239. <MultiTrigger.Conditions>
  240. <Condition Property="IsMouseOver" Value="true" SourceName="PART_Root"/>
  241. <Condition Property="hc:InfoElement.ShowClearButton" Value="True"/>
  242. <Condition Property="hc:InfoElement.IsReadOnly" Value="False" />
  243. </MultiTrigger.Conditions>
  244. <Setter Property="Visibility" Value="Visible" TargetName="ButtonClear"/>
  245. </MultiTrigger>
  246. <Trigger Property="IsFocused" Value="true" SourceName="PART_TextBox">
  247. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  248. </Trigger>
  249. <Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
  250. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}" />
  251. </Trigger>
  252. </ControlTemplate.Triggers>
  253. </ControlTemplate>
  254. <ControlTemplate x:Key="DatePickerPlusLeftTemplate" TargetType="hc:DatePicker">
  255. <Grid MinHeight="{Binding Path=(hc:InfoElement.MinContentHeight),RelativeSource={RelativeSource TemplatedParent}}" Height="{Binding Path=(hc:InfoElement.ContentHeight),RelativeSource={RelativeSource TemplatedParent}}">
  256. <Grid.ColumnDefinitions>
  257. <ColumnDefinition Width="{Binding Path=(hc:InfoElement.TitleWidth),RelativeSource={RelativeSource TemplatedParent}}"/>
  258. <ColumnDefinition/>
  259. </Grid.ColumnDefinitions>
  260. <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}}">
  261. <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}}"/>
  262. <TextBlock hc:TextBlockAttach.AutoTooltip="True" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" Text="{Binding Path=(hc:InfoElement.Title),RelativeSource={RelativeSource TemplatedParent}}"/>
  263. </DockPanel>
  264. <Grid x:Name="PART_Root" Grid.Column="1">
  265. <Grid.ColumnDefinitions>
  266. <ColumnDefinition />
  267. <ColumnDefinition Width="Auto" />
  268. <ColumnDefinition Width="Auto" />
  269. </Grid.ColumnDefinitions>
  270. <Border x:Name="border" Grid.ColumnSpan="3" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" />
  271. <Button Height="Auto" Width="Auto" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" hc:IconElement.Width="14" Command="interactivity:ControlCommands.Clear" Visibility="Collapsed" Name="ButtonClear" Grid.Column="1" Style="{StaticResource ButtonIcon}" Padding="0,0,2,0" hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}" Foreground="{Binding BorderBrush,ElementName=border}" />
  272. <Button Height="Auto" Width="Auto" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" hc:IconElement.Width="14" Style="{StaticResource ButtonIcon}" Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}" hc:IconElement.Geometry="{StaticResource CalendarGeometry}" x:Name="PART_Button" Grid.Column="2" Foreground="{Binding BorderBrush,ElementName=border}" Focusable="False" Grid.Row="0" />
  273. <DatePickerTextBox x:Name="PART_TextBox" Padding="{TemplateBinding Padding}" Grid.Column="0" Focusable="{TemplateBinding Focusable}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Grid.Row="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Style="{StaticResource DatePickerTextBoxStyle}" />
  274. <Popup Grid.Column="0" x:Name="PART_Popup" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" AllowsTransparency="True" Placement="Bottom" PlacementTarget="{Binding ElementName=border}" StaysOpen="False" />
  275. </Grid>
  276. </Grid>
  277. <ControlTemplate.Triggers>
  278. <Trigger Property="hc:InfoElement.IsReadOnly" Value="True">
  279. <Setter TargetName="ButtonClear" Property="IsEnabled" Value="False"/>
  280. <Setter TargetName="PART_Button" Property="IsEnabled" Value="False" />
  281. <Setter TargetName="PART_Button" Property="Visibility" Value="Collapsed" />
  282. <Setter TargetName="PART_TextBox" Property="IsReadOnly" Value="True" />
  283. </Trigger>
  284. <Trigger Property="IsEnabled" Value="false">
  285. <Setter Property="Opacity" TargetName="PART_Root" Value="0.4"/>
  286. </Trigger>
  287. <MultiTrigger>
  288. <MultiTrigger.Conditions>
  289. <Condition Property="IsMouseOver" Value="true" SourceName="PART_Root"/>
  290. <Condition Property="IsOpen" Value="false" SourceName="PART_Popup"/>
  291. </MultiTrigger.Conditions>
  292. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SecondaryBorderBrush}"/>
  293. </MultiTrigger>
  294. <MultiTrigger>
  295. <MultiTrigger.Conditions>
  296. <Condition Property="IsMouseOver" Value="true" SourceName="PART_Root"/>
  297. <Condition Property="IsOpen" Value="true" SourceName="PART_Popup"/>
  298. </MultiTrigger.Conditions>
  299. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  300. </MultiTrigger>
  301. <MultiTrigger>
  302. <MultiTrigger.Conditions>
  303. <Condition Property="IsMouseOver" Value="true" SourceName="PART_Root"/>
  304. <Condition Property="hc:InfoElement.ShowClearButton" Value="True"/>
  305. <Condition Property="hc:InfoElement.IsReadOnly" Value="False" />
  306. </MultiTrigger.Conditions>
  307. <Setter Property="Visibility" Value="Visible" TargetName="ButtonClear"/>
  308. </MultiTrigger>
  309. <Trigger Property="IsFocused" Value="true" SourceName="PART_TextBox">
  310. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}"/>
  311. </Trigger>
  312. <Trigger Property="IsOpen" Value="True" SourceName="PART_Popup">
  313. <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource PrimaryBrush}" />
  314. </Trigger>
  315. </ControlTemplate.Triggers>
  316. </ControlTemplate>
  317. <Style x:Key="DatePickerPlusBaseStyle" BasedOn="{StaticResource DatePickerExtendBaseStyle}" TargetType="hc:DatePicker">
  318. <Setter Property="CaretBrush" Value="{DynamicResource PrimaryTextBrush}"/>
  319. <Setter Property="Template" Value="{StaticResource DatePickerPlusTopTemplate}"/>
  320. <Style.Triggers>
  321. <Trigger Property="hc:InfoElement.TitlePlacement" Value="Left">
  322. <Setter Property="Template" Value="{StaticResource DatePickerPlusLeftTemplate}"/>
  323. <Setter Property="Width" Value="Auto"/>
  324. </Trigger>
  325. </Style.Triggers>
  326. </Style>
  327. </ResourceDictionary>