Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

329 lignes
22 KiB

  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:bpa="clr-namespace:BPA.UIControl">
  4. <ResourceDictionary.MergedDictionaries>
  5. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Button.xaml" />
  6. </ResourceDictionary.MergedDictionaries>
  7. <Style x:Key="RubyerCalendarDayButtonStyle" TargetType="CalendarDayButton">
  8. <Setter Property="Background" Value="Transparent" />
  9. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  10. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  11. <Setter Property="BorderThickness" Value="{DynamicResource DefaultBorderThickness}" />
  12. <Setter Property="FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource AncestorType=Calendar}}" />
  13. <Setter Property="HorizontalContentAlignment" Value="Center" />
  14. <Setter Property="VerticalContentAlignment" Value="Center" />
  15. <Setter Property="MinHeight" Value="25" />
  16. <Setter Property="MinWidth" Value="30" />
  17. <Setter Property="Padding" Value="5 2" />
  18. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllControlCornerRadius}" />
  19. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="1" />
  20. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Primary}" />
  21. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource WhiteForeground}" />
  22. <Setter Property="Template">
  23. <Setter.Value>
  24. <ControlTemplate TargetType="CalendarDayButton">
  25. <Grid>
  26. <bpa:ControlMask Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  27. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  28. IsActive="{TemplateBinding IsSelected}"
  29. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  30. <Ellipse x:Name="TodayDot"
  31. Width="5"
  32. Height="5"
  33. Margin="2"
  34. HorizontalAlignment="Right"
  35. VerticalAlignment="Top"
  36. Fill="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  37. Opacity="0" />
  38. <ContentPresenter x:Name="NormalText"
  39. Margin="{TemplateBinding Padding}"
  40. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  41. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  42. <Path x:Name="Blackout"
  43. Margin="3"
  44. HorizontalAlignment="Stretch"
  45. VerticalAlignment="Stretch"
  46. Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633, 11.029181 L15.191895,11.029181 L12.844727, 13.999395 L15.21875,17.060919 L12.962891, 17.060919 L11.673828,15.256231 L10.352539, 17.060919 L8.1396484,17.060919 L10.519043, 14.042364 z"
  47. Opacity="0"
  48. RenderTransformOrigin="0.5,0.5"
  49. Stretch="Fill" />
  50. <VisualStateManager.VisualStateGroups>
  51. <VisualStateGroup Name="CommonStates">
  52. <VisualStateGroup.Transitions>
  53. <VisualTransition GeneratedDuration="0:0:0.25" />
  54. </VisualStateGroup.Transitions>
  55. <VisualState Name="Normal" />
  56. <VisualState Name="MouseOver" />
  57. <VisualState Name="Pressed" />
  58. <VisualState Name="Disabled">
  59. <Storyboard>
  60. <DoubleAnimation Storyboard.TargetName="NormalText"
  61. Storyboard.TargetProperty="Opacity"
  62. To=".35"
  63. Duration="0" />
  64. </Storyboard>
  65. </VisualState>
  66. </VisualStateGroup>
  67. <VisualStateGroup Name="SelectionStates">
  68. <VisualStateGroup.Transitions>
  69. <VisualTransition GeneratedDuration="0" />
  70. </VisualStateGroup.Transitions>
  71. <VisualState Name="Unselected" />
  72. <VisualState Name="Selected" />
  73. </VisualStateGroup>
  74. <VisualStateGroup Name="CalendarButtonFocusStates">
  75. <VisualStateGroup.Transitions>
  76. <VisualTransition GeneratedDuration="0" />
  77. </VisualStateGroup.Transitions>
  78. <VisualState Name="CalendarButtonFocused" />
  79. <VisualState Name="CalendarButtonUnfocused" />
  80. </VisualStateGroup>
  81. <VisualStateGroup Name="ActiveStates">
  82. <VisualStateGroup.Transitions>
  83. <VisualTransition GeneratedDuration="0" />
  84. </VisualStateGroup.Transitions>
  85. <VisualState Name="Active" />
  86. <VisualState Name="Inactive" />
  87. </VisualStateGroup>
  88. <VisualStateGroup Name="DayStates">
  89. <VisualStateGroup.Transitions>
  90. <VisualTransition GeneratedDuration="0" />
  91. </VisualStateGroup.Transitions>
  92. <VisualState Name="RegularDay" />
  93. <VisualState Name="Today">
  94. <Storyboard>
  95. <DoubleAnimation Storyboard.TargetName="TodayDot"
  96. Storyboard.TargetProperty="Opacity"
  97. To="1"
  98. Duration="0" />
  99. </Storyboard>
  100. </VisualState>
  101. </VisualStateGroup>
  102. <VisualStateGroup Name="BlackoutDayStates">
  103. <VisualStateGroup.Transitions>
  104. <VisualTransition GeneratedDuration="0" />
  105. </VisualStateGroup.Transitions>
  106. <VisualState Name="NormalDay" />
  107. <VisualState Name="BlackoutDay">
  108. <Storyboard>
  109. <DoubleAnimation Storyboard.TargetName="Blackout"
  110. Storyboard.TargetProperty="Opacity"
  111. To=".2"
  112. Duration="0" />
  113. </Storyboard>
  114. </VisualState>
  115. </VisualStateGroup>
  116. </VisualStateManager.VisualStateGroups>
  117. </Grid>
  118. <ControlTemplate.Triggers>
  119. <Trigger Property="IsSelected" Value="True">
  120. <Setter TargetName="NormalText" Property="TextBlock.Foreground" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  121. <Setter TargetName="TodayDot" Property="Fill" Value="{Binding Path=(bpa:ControlHelper.FocusedForegroundBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  122. </Trigger>
  123. <Trigger Property="IsInactive" Value="True">
  124. <Setter TargetName="NormalText" Property="Opacity" Value="0.4" />
  125. </Trigger>
  126. </ControlTemplate.Triggers>
  127. </ControlTemplate>
  128. </Setter.Value>
  129. </Setter>
  130. </Style>
  131. <!-- Style for the months of a year and years of a decade. -->
  132. <Style x:Key="RubyerCalendarButtonStyle" TargetType="CalendarButton">
  133. <Setter Property="Background" Value="Transparent" />
  134. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  135. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  136. <Setter Property="BorderThickness" Value="{DynamicResource DefaultBorderThickness}" />
  137. <Setter Property="HorizontalContentAlignment" Value="Center" />
  138. <Setter Property="FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource AncestorType=Calendar}}" />
  139. <Setter Property="MinHeight" Value="50" />
  140. <Setter Property="MinWidth" Value="50" />
  141. <Setter Property="VerticalContentAlignment" Value="Center" />
  142. <Setter Property="Margin" Value="1" />
  143. <Setter Property="Padding" Value="5" />
  144. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllControlCornerRadius}" />
  145. <Setter Property="bpa:ControlHelper.MaskOpacity" Value="1" />
  146. <Setter Property="bpa:ControlHelper.FocusedBrush" Value="{DynamicResource Primary}" />
  147. <Setter Property="bpa:ControlHelper.FocusedForegroundBrush" Value="{DynamicResource WhiteForeground}" />
  148. <Setter Property="Template">
  149. <Setter.Value>
  150. <ControlTemplate TargetType="CalendarButton">
  151. <Grid>
  152. <bpa:ControlMask Background="{Binding Path=(bpa:ControlHelper.FocusedBrush), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  153. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  154. MaskOpacity="{Binding Path=(bpa:ControlHelper.MaskOpacity), RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  155. <ContentPresenter x:Name="NormalText"
  156. Margin="{TemplateBinding Padding}"
  157. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  158. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  159. </Grid>
  160. </ControlTemplate>
  161. </Setter.Value>
  162. </Setter>
  163. </Style>
  164. <Style x:Key="RubyerCalendarItemStyle" TargetType="{x:Type CalendarItem}">
  165. <Setter Property="Margin" Value="0" />
  166. <Setter Property="Template">
  167. <Setter.Value>
  168. <ControlTemplate TargetType="{x:Type CalendarItem}">
  169. <Grid x:Name="PART_Root">
  170. <Grid.RowDefinitions>
  171. <RowDefinition Height="Auto" />
  172. <RowDefinition Height="*" />
  173. </Grid.RowDefinitions>
  174. <Border x:Name="headBorder"
  175. Background="{Binding Path=(bpa:HeaderHelper.Background), RelativeSource={RelativeSource AncestorType=Calendar}}"
  176. CornerRadius="{DynamicResource TopContainerCornerRadius}"
  177. TextBlock.FontFamily="{Binding Path=(bpa:HeaderHelper.FontFamily), RelativeSource={RelativeSource AncestorType=Calendar}}"
  178. TextBlock.FontSize="{Binding Path=(bpa:HeaderHelper.FontSize), RelativeSource={RelativeSource AncestorType=Calendar}}"
  179. TextBlock.FontWeight="{Binding Path=(bpa:HeaderHelper.FontWeight), RelativeSource={RelativeSource AncestorType=Calendar}}"
  180. TextBlock.Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource AncestorType=Calendar}}">
  181. <Grid Margin="{Binding Path=(bpa:HeaderHelper.Padding), RelativeSource={RelativeSource AncestorType=Calendar}}"
  182. HorizontalAlignment="{Binding Path=(bpa:HeaderHelper.HorizontalAlignment), RelativeSource={RelativeSource AncestorType=Calendar}}"
  183. VerticalAlignment="{Binding Path=(bpa:HeaderHelper.VerticalAlignment), RelativeSource={RelativeSource AncestorType=Calendar}}">
  184. <Grid.ColumnDefinitions>
  185. <ColumnDefinition Width="*" />
  186. <ColumnDefinition Width="Auto" />
  187. <ColumnDefinition Width="Auto" />
  188. </Grid.ColumnDefinitions>
  189. <Button x:Name="PART_HeaderButton"
  190. Style="{StaticResource TextButton}"
  191. Grid.Column="0"
  192. Margin="10 0"
  193. Padding="5"
  194. HorizontalContentAlignment="Left"
  195. Focusable="False"
  196. Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource AncestorType=Calendar}}" />
  197. <Button x:Name="PART_PreviousButton"
  198. Style="{StaticResource TextButton}"
  199. Grid.Column="1"
  200. Padding="5"
  201. Focusable="False"
  202. Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource AncestorType=Calendar}}">
  203. <bpa:Icon Type="ArrowUpSLine" />
  204. </Button>
  205. <Button x:Name="PART_NextButton"
  206. Style="{StaticResource TextButton}"
  207. Grid.Column="2"
  208. Padding="5"
  209. Focusable="False"
  210. Foreground="{Binding Path=(bpa:HeaderHelper.Foreground), RelativeSource={RelativeSource AncestorType=Calendar}}">
  211. <bpa:Icon Type="ArrowDownSLine" />
  212. </Button>
  213. </Grid>
  214. </Border>
  215. <Grid x:Name="PART_MonthView"
  216. Grid.Row="1"
  217. Margin="5"
  218. HorizontalAlignment="Center"
  219. Visibility="Visible">
  220. <Grid.ColumnDefinitions>
  221. <ColumnDefinition Width="Auto" />
  222. <ColumnDefinition Width="Auto" />
  223. <ColumnDefinition Width="Auto" />
  224. <ColumnDefinition Width="Auto" />
  225. <ColumnDefinition Width="Auto" />
  226. <ColumnDefinition Width="Auto" />
  227. <ColumnDefinition Width="Auto" />
  228. </Grid.ColumnDefinitions>
  229. <Grid.RowDefinitions>
  230. <RowDefinition Height="Auto" />
  231. <RowDefinition Height="Auto" />
  232. <RowDefinition Height="Auto" />
  233. <RowDefinition Height="Auto" />
  234. <RowDefinition Height="Auto" />
  235. <RowDefinition Height="Auto" />
  236. <RowDefinition Height="Auto" />
  237. </Grid.RowDefinitions>
  238. </Grid>
  239. <Grid x:Name="PART_YearView"
  240. Grid.Row="1"
  241. Grid.ColumnSpan="3"
  242. Margin="5 15 5 5"
  243. HorizontalAlignment="Center"
  244. Visibility="Hidden">
  245. <Grid.ColumnDefinitions>
  246. <ColumnDefinition Width="Auto" />
  247. <ColumnDefinition Width="Auto" />
  248. <ColumnDefinition Width="Auto" />
  249. <ColumnDefinition Width="Auto" />
  250. </Grid.ColumnDefinitions>
  251. <Grid.RowDefinitions>
  252. <RowDefinition Height="Auto" />
  253. <RowDefinition Height="Auto" />
  254. <RowDefinition Height="Auto" />
  255. </Grid.RowDefinitions>
  256. </Grid>
  257. </Grid>
  258. <ControlTemplate.Triggers>
  259. <Trigger Property="IsEnabled" Value="False">
  260. <Setter TargetName="PART_Root" Property="Opacity" Value="{StaticResource UnenableOpcity}" />
  261. </Trigger>
  262. <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Year">
  263. <Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
  264. <Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
  265. </DataTrigger>
  266. <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Decade">
  267. <Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
  268. <Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
  269. </DataTrigger>
  270. </ControlTemplate.Triggers>
  271. </ControlTemplate>
  272. </Setter.Value>
  273. </Setter>
  274. </Style>
  275. <Style x:Key="RubyerCalendar" TargetType="{x:Type Calendar}">
  276. <Setter Property="Background" Value="{DynamicResource FloatBackground}" />
  277. <Setter Property="BorderBrush" Value="{DynamicResource Border}" />
  278. <Setter Property="BorderThickness" Value="0" />
  279. <Setter Property="CalendarButtonStyle" Value="{StaticResource RubyerCalendarButtonStyle}" />
  280. <Setter Property="CalendarDayButtonStyle" Value="{StaticResource RubyerCalendarDayButtonStyle}" />
  281. <Setter Property="CalendarItemStyle" Value="{StaticResource RubyerCalendarItemStyle}" />
  282. <Setter Property="Foreground" Value="{DynamicResource DefaultForeground}" />
  283. <Setter Property="Margin" Value="5" />
  284. <Setter Property="HorizontalAlignment" Value="Center" />
  285. <Setter Property="VerticalAlignment" Value="Center" />
  286. <Setter Property="bpa:ControlHelper.CornerRadius" Value="{DynamicResource AllContainerCornerRadius}" />
  287. <Setter Property="bpa:HeaderHelper.Background" Value="{DynamicResource Primary}" />
  288. <Setter Property="bpa:HeaderHelper.Foreground" Value="{DynamicResource WhiteForeground}" />
  289. <Setter Property="bpa:HeaderHelper.FontSize" Value="{Binding FontSize, RelativeSource={RelativeSource Self}, Converter={StaticResource AddConverter}, ConverterParameter=5}" />
  290. <Setter Property="bpa:HeaderHelper.FontWeight" Value="Normal" />
  291. <Setter Property="bpa:HeaderHelper.HorizontalAlignment" Value="Stretch" />
  292. <Setter Property="bpa:HeaderHelper.VerticalAlignment" Value="Center" />
  293. <Setter Property="bpa:HeaderHelper.Padding" Value="5" />
  294. <Setter Property="Template">
  295. <Setter.Value>
  296. <ControlTemplate TargetType="{x:Type Calendar}">
  297. <Grid>
  298. <Border Background="{TemplateBinding Background}"
  299. CornerRadius="{Binding Path=(bpa:ControlHelper.CornerRadius), RelativeSource={RelativeSource Mode=TemplatedParent}}"
  300. Effect="{DynamicResource AllDirectionEffect3}" />
  301. <StackPanel x:Name="PART_Root" HorizontalAlignment="Center">
  302. <CalendarItem x:Name="PART_CalendarItem"
  303. Style="{TemplateBinding CalendarItemStyle}"
  304. Background="{TemplateBinding Background}"
  305. BorderBrush="{TemplateBinding BorderBrush}"
  306. BorderThickness="{TemplateBinding BorderThickness}" />
  307. </StackPanel>
  308. </Grid>
  309. </ControlTemplate>
  310. </Setter.Value>
  311. </Setter>
  312. </Style>
  313. </ResourceDictionary>