DatePickerStyle.xaml 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  3. <Style x:Key="TextBolockTriggers" TargetType="Grid">
  4. <Style.Triggers>
  5. <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周六">
  6. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush49}"/>
  7. </DataTrigger>
  8. <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周日">
  9. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush49}"/>
  10. </DataTrigger>
  11. <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周一">
  12. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush2}"/>
  13. </DataTrigger>
  14. <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周二">
  15. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush2}"/>
  16. </DataTrigger>
  17. <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周三">
  18. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush2}"/>
  19. </DataTrigger>
  20. <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周四">
  21. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush2}"/>
  22. </DataTrigger>
  23. <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周五">
  24. <Setter Property="Background" Value="{DynamicResource MuchinfoBrush2}"/>
  25. </DataTrigger>
  26. </Style.Triggers>
  27. </Style>
  28. <!--日历主体样式表-->
  29. <Style x:Key="CalendarItemStyle"
  30. TargetType="{x:Type CalendarItem}">
  31. <Setter Property="Template">
  32. <Setter.Value>
  33. <ControlTemplate TargetType="{x:Type CalendarItem}">
  34. <ControlTemplate.Resources>
  35. <DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
  36. <!--日历星期几的绑定样式,我格式化成周一,周二等-->
  37. <Grid Height="30"
  38. Width="50"
  39. Style="{StaticResource TextBolockTriggers}"
  40. Margin="1"
  41. HorizontalAlignment="Center"
  42. VerticalAlignment="Center">
  43. <TextBlock x:Name="txtBlock"
  44. FontSize="13"
  45. FontFamily="微软雅黑"
  46. HorizontalAlignment="Center"
  47. Text="{Binding StringFormat=周{0}}"
  48. VerticalAlignment="Center" />
  49. </Grid>
  50. </DataTemplate>
  51. </ControlTemplate.Resources>
  52. <Grid x:Name="PART_Root">
  53. <Grid.Resources>
  54. <!--设置日历控件 IsEnable=false 时的不可用遮罩层颜色,并且会播放过渡动画-->
  55. <SolidColorBrush x:Key="DisabledColor"
  56. Color="#A5FFFFFF" />
  57. </Grid.Resources>
  58. <VisualStateManager.VisualStateGroups>
  59. <VisualStateGroup x:Name="CommonStates">
  60. <VisualState x:Name="Normal" />
  61. <VisualState x:Name="Disabled">
  62. <!--设置日历控件 IsEnable=false 时遮罩层透明度0-1变色动画-->
  63. <Storyboard>
  64. <DoubleAnimation Duration="0"
  65. To="1"
  66. Storyboard.TargetProperty="Opacity"
  67. Storyboard.TargetName="PART_DisabledVisual" />
  68. </Storyboard>
  69. </VisualState>
  70. </VisualStateGroup>
  71. </VisualStateManager.VisualStateGroups>
  72. <Border BorderBrush="#cfcfcf"
  73. BorderThickness="0"
  74. Background="{TemplateBinding Background}"
  75. CornerRadius="2">
  76. <Border>
  77. <Grid>
  78. <Grid.Resources>
  79. <!--日历头左箭头按钮样式模版-->
  80. <ControlTemplate x:Key="PreviousButtonTemplate"
  81. TargetType="{x:Type Button}">
  82. <!--鼠标悬停在左箭头按钮上时改变鼠标指针样式-->
  83. <Grid Cursor="Hand">
  84. <VisualStateManager.VisualStateGroups>
  85. <VisualStateGroup x:Name="CommonStates">
  86. <VisualState x:Name="Normal" />
  87. <VisualState x:Name="MouseOver">
  88. <!--鼠标悬停在左箭头按钮上时左箭头颜色变化动画-->
  89. <Storyboard>
  90. <ColorAnimation Duration="0"
  91. To="#ffFFFFFf"
  92. Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
  93. Storyboard.TargetName="path" />
  94. </Storyboard>
  95. </VisualState>
  96. <VisualState x:Name="Disabled">
  97. <Storyboard>
  98. <DoubleAnimation Duration="0"
  99. To=".5"
  100. Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)"
  101. Storyboard.TargetName="path" />
  102. </Storyboard>
  103. </VisualState>
  104. </VisualStateGroup>
  105. </VisualStateManager.VisualStateGroups>
  106. <!--左箭头整个区域矩形块-->
  107. <Rectangle Fill="{DynamicResource MuchinfoBrush6}"
  108. Opacity="1"
  109. Stretch="Fill" />
  110. <Grid>
  111. <!--左箭头-->
  112. <Path x:Name="path"
  113. Data="M288.75,232.25 L288.75,240.625 L283,236.625 z"
  114. Fill="#e0e0e0"
  115. HorizontalAlignment="Left"
  116. Height="15"
  117. Width="15"
  118. Margin="20,0,0,0"
  119. Stretch="Fill"
  120. VerticalAlignment="Center" />
  121. </Grid>
  122. </Grid>
  123. </ControlTemplate>
  124. <!--日历头右箭头按钮样式模版,这块跟左箭头样式模版没什么区别-->
  125. <ControlTemplate x:Key="NextButtonTemplate"
  126. TargetType="{x:Type Button}">
  127. <Grid Cursor="Hand">
  128. <VisualStateManager.VisualStateGroups>
  129. <VisualStateGroup x:Name="CommonStates">
  130. <VisualState x:Name="Normal" />
  131. <VisualState x:Name="MouseOver">
  132. <Storyboard>
  133. <ColorAnimation Duration="0"
  134. To="#ffFFFFFf"
  135. Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
  136. Storyboard.TargetName="path" />
  137. </Storyboard>
  138. </VisualState>
  139. <VisualState x:Name="Disabled">
  140. <Storyboard>
  141. <DoubleAnimation Duration="0"
  142. To=".5"
  143. Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)"
  144. Storyboard.TargetName="path" />
  145. </Storyboard>
  146. </VisualState>
  147. </VisualStateGroup>
  148. </VisualStateManager.VisualStateGroups>
  149. <Rectangle Fill="{DynamicResource MuchinfoBrush6}"
  150. Opacity="1"
  151. Stretch="Fill" />
  152. <Grid>
  153. <Path x:Name="path"
  154. Data="M282.875,231.875 L282.875,240.375 L288.625,236 z"
  155. Fill="#e0e0e0"
  156. HorizontalAlignment="Right"
  157. Height="15"
  158. Width="15"
  159. Margin="0,0,20,0"
  160. Stretch="Fill"
  161. VerticalAlignment="Center" />
  162. </Grid>
  163. </Grid>
  164. </ControlTemplate>
  165. <!--日历头中间年按钮样式模版-->
  166. <ControlTemplate x:Key="HeaderButtonTemplate"
  167. TargetType="{x:Type Button}">
  168. <Grid Cursor="Hand">
  169. <VisualStateManager.VisualStateGroups>
  170. <VisualStateGroup x:Name="CommonStates">
  171. <VisualState x:Name="Normal" />
  172. <VisualState x:Name="MouseOver">
  173. <Storyboard>
  174. <ColorAnimation Duration="0"
  175. To="#ffFFFFFf"
  176. Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
  177. Storyboard.TargetName="buttonContent" />
  178. </Storyboard>
  179. </VisualState>
  180. <VisualState x:Name="Disabled">
  181. <Storyboard>
  182. <DoubleAnimation Duration="0"
  183. To=".5"
  184. Storyboard.TargetProperty="Opacity"
  185. Storyboard.TargetName="buttonContent" />
  186. </Storyboard>
  187. </VisualState>
  188. </VisualStateGroup>
  189. </VisualStateManager.VisualStateGroups>
  190. <ContentPresenter x:Name="buttonContent"
  191. ContentTemplate="{TemplateBinding ContentTemplate}"
  192. Content="{TemplateBinding Content}"
  193. TextElement.Foreground="#e0e0e0"
  194. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  195. Margin="1,4,1,9"
  196. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  197. </Grid>
  198. </ControlTemplate>
  199. </Grid.Resources>
  200. <Grid.RowDefinitions>
  201. <!--日历头,左箭头,年,右箭头-->
  202. <RowDefinition Height="Auto" />
  203. <!--日历内容,星期几和具体的日期几号几号-->
  204. <RowDefinition Height="*" />
  205. </Grid.RowDefinitions>
  206. <Grid.ColumnDefinitions>
  207. <!--左箭头-->
  208. <ColumnDefinition Width="Auto" />
  209. <!--年-->
  210. <ColumnDefinition Width="*" />
  211. <!--右箭头-->
  212. <ColumnDefinition Width="Auto" />
  213. </Grid.ColumnDefinitions>
  214. <!--头,左箭头,年,右箭头,整体的背景色-->
  215. <Border Grid.Row="0"
  216. Grid.ColumnSpan="3"
  217. Background="{DynamicResource MuchinfoBrush6}"></Border>
  218. <!--左箭头-->
  219. <Button x:Name="PART_PreviousButton"
  220. Grid.Column="0"
  221. Focusable="False"
  222. HorizontalAlignment="Left"
  223. Grid.Row="0"
  224. Template="{StaticResource PreviousButtonTemplate}" />
  225. <!--年-->
  226. <Button x:Name="PART_HeaderButton"
  227. Grid.Column="1"
  228. FontFamily="微软雅黑"
  229. Focusable="False"
  230. FontSize="17"
  231. HorizontalAlignment="Center"
  232. Grid.Row="0"
  233. Template="{StaticResource HeaderButtonTemplate}"
  234. VerticalAlignment="Center" />
  235. <!--右箭头-->
  236. <Button x:Name="PART_NextButton"
  237. Grid.Column="2"
  238. Focusable="False"
  239. HorizontalAlignment="Right"
  240. Grid.Row="0"
  241. Template="{StaticResource NextButtonTemplate}" />
  242. <!--日期几号几号内容显示-->
  243. <Border Grid.Row="1"
  244. Grid.ColumnSpan="3"
  245. Margin="0"
  246. BorderBrush="#cfcfcf"
  247. BorderThickness="3,0,3,3">
  248. <Grid x:Name="PART_MonthView"
  249. HorizontalAlignment="Center"
  250. Visibility="Visible">
  251. <Grid.ColumnDefinitions>
  252. <ColumnDefinition Width="*" />
  253. <ColumnDefinition Width="*" />
  254. <ColumnDefinition Width="*" />
  255. <ColumnDefinition Width="*" />
  256. <ColumnDefinition Width="*" />
  257. <ColumnDefinition Width="*" />
  258. <ColumnDefinition Width="*" />
  259. </Grid.ColumnDefinitions>
  260. <Grid.RowDefinitions>
  261. <RowDefinition Height="auto" />
  262. <RowDefinition Height="*" />
  263. <RowDefinition Height="*" />
  264. <RowDefinition Height="*" />
  265. <RowDefinition Height="*" />
  266. <RowDefinition Height="*" />
  267. <RowDefinition Height="*" />
  268. </Grid.RowDefinitions>
  269. </Grid>
  270. </Border>
  271. <!--月和年内容显示-->
  272. <Grid x:Name="PART_YearView"
  273. Grid.ColumnSpan="3"
  274. HorizontalAlignment="Center"
  275. Margin="6,-3,7,6"
  276. Grid.Row="1"
  277. Visibility="Hidden"
  278. VerticalAlignment="Center">
  279. <Grid.ColumnDefinitions>
  280. <ColumnDefinition Width="*" />
  281. <ColumnDefinition Width="*" />
  282. <ColumnDefinition Width="*" />
  283. <ColumnDefinition Width="*" />
  284. </Grid.ColumnDefinitions>
  285. <Grid.RowDefinitions>
  286. <RowDefinition Height="*" />
  287. <RowDefinition Height="*" />
  288. <RowDefinition Height="*" />
  289. </Grid.RowDefinitions>
  290. </Grid>
  291. </Grid>
  292. </Border>
  293. </Border>
  294. <!--日历不可用的遮罩层-->
  295. <Rectangle x:Name="PART_DisabledVisual"
  296. Fill="{StaticResource DisabledColor}"
  297. Opacity="0"
  298. RadiusY="2"
  299. RadiusX="2"
  300. Stretch="Fill"
  301. Stroke="{StaticResource DisabledColor}"
  302. StrokeThickness="1"
  303. Visibility="Collapsed" />
  304. </Grid>
  305. <!--触发器属性-->
  306. <ControlTemplate.Triggers>
  307. <Trigger Property="IsEnabled"
  308. Value="False">
  309. <Setter Property="Visibility"
  310. TargetName="PART_DisabledVisual"
  311. Value="Visible" />
  312. </Trigger>
  313. <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}"
  314. Value="Year">
  315. <Setter Property="Visibility"
  316. TargetName="PART_MonthView"
  317. Value="Hidden" />
  318. <Setter Property="Visibility"
  319. TargetName="PART_YearView"
  320. Value="Visible" />
  321. </DataTrigger>
  322. <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}"
  323. Value="Decade">
  324. <Setter Property="Visibility"
  325. TargetName="PART_MonthView"
  326. Value="Hidden" />
  327. <Setter Property="Visibility"
  328. TargetName="PART_YearView"
  329. Value="Visible" />
  330. </DataTrigger>
  331. </ControlTemplate.Triggers>
  332. </ControlTemplate>
  333. </Setter.Value>
  334. </Setter>
  335. </Style>
  336. <!--单个几号几号按钮的样式模版-->
  337. <Style x:Key="CalendarDayButtonStyle"
  338. TargetType="{x:Type CalendarDayButton}">
  339. <Setter Property="Margin"
  340. Value="1" />
  341. <Setter Property="MinWidth"
  342. Value="5" />
  343. <Setter Property="MinHeight"
  344. Value="5" />
  345. <Setter Property="FontSize"
  346. Value="15" />
  347. <Setter Property="FontFamily"
  348. Value="微软雅黑" />
  349. <Setter Property="HorizontalContentAlignment"
  350. Value="Center" />
  351. <Setter Property="VerticalContentAlignment"
  352. Value="Center" />
  353. <Setter Property="Template">
  354. <Setter.Value>
  355. <ControlTemplate TargetType="{x:Type CalendarDayButton}">
  356. <Grid>
  357. <VisualStateManager.VisualStateGroups>
  358. <VisualStateGroup x:Name="CommonStates">
  359. <VisualStateGroup.Transitions>
  360. <VisualTransition GeneratedDuration="0:0:0.1" />
  361. </VisualStateGroup.Transitions>
  362. <VisualState x:Name="Normal" />
  363. <!--悬停的颜色动画-->
  364. <VisualState x:Name="MouseOver">
  365. <Storyboard>
  366. <DoubleAnimation Duration="0"
  367. To="0.5"
  368. Storyboard.TargetProperty="Opacity"
  369. Storyboard.TargetName="HighlightBackground" />
  370. </Storyboard>
  371. </VisualState>
  372. <!--按下后动画-->
  373. <VisualState x:Name="Pressed">
  374. <Storyboard>
  375. <DoubleAnimation Duration="0"
  376. To="0.5"
  377. Storyboard.TargetProperty="Opacity"
  378. Storyboard.TargetName="HighlightBackground" />
  379. </Storyboard>
  380. </VisualState>
  381. <!--不可用动画-->
  382. <VisualState x:Name="Disabled">
  383. <Storyboard>
  384. <DoubleAnimation Duration="0"
  385. To="0"
  386. Storyboard.TargetProperty="Opacity"
  387. Storyboard.TargetName="HighlightBackground" />
  388. <DoubleAnimation Duration="0"
  389. To=".35"
  390. Storyboard.TargetProperty="Opacity"
  391. Storyboard.TargetName="NormalText" />
  392. </Storyboard>
  393. </VisualState>
  394. </VisualStateGroup>
  395. <VisualStateGroup x:Name="SelectionStates">
  396. <VisualStateGroup.Transitions>
  397. <VisualTransition GeneratedDuration="0" />
  398. </VisualStateGroup.Transitions>
  399. <VisualState x:Name="Unselected" />
  400. <!--选中某日期的样式-->
  401. <VisualState x:Name="Selected">
  402. <Storyboard>
  403. <DoubleAnimation Duration="0"
  404. To=".75"
  405. Storyboard.TargetProperty="Opacity"
  406. Storyboard.TargetName="SelectedBackground" />
  407. <ColorAnimation Duration="0"
  408. To="white"
  409. Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
  410. Storyboard.TargetName="NormalText" />
  411. </Storyboard>
  412. </VisualState>
  413. </VisualStateGroup>
  414. <VisualStateGroup x:Name="CalendarButtonFocusStates">
  415. <VisualStateGroup.Transitions>
  416. <VisualTransition GeneratedDuration="0" />
  417. </VisualStateGroup.Transitions>
  418. <VisualState x:Name="CalendarButtonFocused">
  419. <Storyboard>
  420. <ObjectAnimationUsingKeyFrames Duration="0"
  421. Storyboard.TargetProperty="Visibility"
  422. Storyboard.TargetName="DayButtonFocusVisual">
  423. <DiscreteObjectKeyFrame KeyTime="0">
  424. <DiscreteObjectKeyFrame.Value>
  425. <Visibility>Visible</Visibility>
  426. </DiscreteObjectKeyFrame.Value>
  427. </DiscreteObjectKeyFrame>
  428. </ObjectAnimationUsingKeyFrames>
  429. </Storyboard>
  430. </VisualState>
  431. <VisualState x:Name="CalendarButtonUnfocused">
  432. <Storyboard>
  433. <ObjectAnimationUsingKeyFrames Duration="0"
  434. Storyboard.TargetProperty="Visibility"
  435. Storyboard.TargetName="DayButtonFocusVisual">
  436. <DiscreteObjectKeyFrame KeyTime="0">
  437. <DiscreteObjectKeyFrame.Value>
  438. <Visibility>Collapsed</Visibility>
  439. </DiscreteObjectKeyFrame.Value>
  440. </DiscreteObjectKeyFrame>
  441. </ObjectAnimationUsingKeyFrames>
  442. </Storyboard>
  443. </VisualState>
  444. </VisualStateGroup>
  445. <VisualStateGroup x:Name="ActiveStates">
  446. <VisualStateGroup.Transitions>
  447. <VisualTransition GeneratedDuration="0" />
  448. </VisualStateGroup.Transitions>
  449. <VisualState x:Name="Active" />
  450. <VisualState x:Name="Inactive">
  451. <Storyboard>
  452. <ColorAnimation Duration="0"
  453. To="#b4b3b3"
  454. Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
  455. Storyboard.TargetName="NormalText" />
  456. </Storyboard>
  457. </VisualState>
  458. </VisualStateGroup>
  459. <VisualStateGroup x:Name="DayStates">
  460. <VisualStateGroup.Transitions>
  461. <VisualTransition GeneratedDuration="0" />
  462. </VisualStateGroup.Transitions>
  463. <VisualState x:Name="RegularDay" />
  464. <!--今天的样式-->
  465. <VisualState x:Name="Today">
  466. <Storyboard>
  467. <DoubleAnimation Duration="0"
  468. To="1"
  469. Storyboard.TargetProperty="Opacity"
  470. Storyboard.TargetName="TodayBackground" />
  471. <ColorAnimation Duration="0"
  472. To="#666666"
  473. Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
  474. Storyboard.TargetName="NormalText" />
  475. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
  476. Storyboard.TargetName="imgToday">
  477. <DiscreteObjectKeyFrame KeyTime="0">
  478. <DiscreteObjectKeyFrame.Value>
  479. <Visibility>Visible</Visibility>
  480. </DiscreteObjectKeyFrame.Value>
  481. </DiscreteObjectKeyFrame>
  482. </ObjectAnimationUsingKeyFrames>
  483. </Storyboard>
  484. </VisualState>
  485. </VisualStateGroup>
  486. <!--过期日期的-->
  487. <VisualStateGroup x:Name="BlackoutDayStates">
  488. <VisualStateGroup.Transitions>
  489. <VisualTransition GeneratedDuration="0" />
  490. </VisualStateGroup.Transitions>
  491. <VisualState x:Name="NormalDay" />
  492. <VisualState x:Name="BlackoutDay">
  493. <Storyboard>
  494. <DoubleAnimation Duration="0"
  495. To=".2"
  496. Storyboard.TargetProperty="Opacity"
  497. Storyboard.TargetName="Blackout" />
  498. </Storyboard>
  499. </VisualState>
  500. </VisualStateGroup>
  501. </VisualStateManager.VisualStateGroups>
  502. <Border BorderBrush="#bbbbbb"
  503. BorderThickness="1">
  504. <Border BorderBrush="white"
  505. BorderThickness="2,2,0,0"
  506. Margin="1,1,0,0"></Border>
  507. </Border>
  508. <Rectangle x:Name="TodayBackground"
  509. Fill="#c6c6c6"
  510. Opacity="0"
  511. RadiusY="1"
  512. RadiusX="1" />
  513. <Rectangle x:Name="SelectedBackground"
  514. Fill="{DynamicResource MuchinfoBrush3}"
  515. Opacity="0"
  516. RadiusY="1"
  517. RadiusX="1" />
  518. <Border BorderBrush="{TemplateBinding BorderBrush}"
  519. BorderThickness="{TemplateBinding BorderThickness}"
  520. Background="{TemplateBinding Background}" />
  521. <Rectangle x:Name="HighlightBackground"
  522. Fill="{DynamicResource MuchinfoBrush57}"
  523. Opacity="0"
  524. RadiusY="1"
  525. RadiusX="1" />
  526. <ContentPresenter x:Name="NormalText"
  527. TextElement.Foreground="#666666"
  528. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  529. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  530. <Path x:Name="Blackout"
  531. 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"
  532. Fill="#FF000000"
  533. HorizontalAlignment="Stretch"
  534. Margin="3"
  535. Opacity="0"
  536. RenderTransformOrigin="0.5,0.5"
  537. Stretch="Fill"
  538. VerticalAlignment="Stretch" />
  539. <Rectangle x:Name="DayButtonFocusVisual"
  540. IsHitTestVisible="false"
  541. RadiusY="1"
  542. RadiusX="1"
  543. Stroke="{DynamicResource MuchinfoBrush3}"
  544. Visibility="Collapsed" />
  545. <Image x:Name="imgToday"
  546. Width="32"
  547. Height="22"
  548. Source="/Muchinfo.MTPClient;component/Images/today.png"
  549. VerticalAlignment="Top"
  550. HorizontalAlignment="Left"
  551. Visibility="Hidden" />
  552. </Grid>
  553. </ControlTemplate>
  554. </Setter.Value>
  555. </Setter>
  556. </Style>
  557. <Style x:Key="CalendarButtonStyle"
  558. TargetType="{x:Type CalendarButton}">
  559. <Setter Property="Background"
  560. Value="{DynamicResource MuchinfoBrush57}" />
  561. <Setter Property="MinWidth"
  562. Value="50" />
  563. <Setter Property="MinHeight"
  564. Value="50" />
  565. <Setter Property="Margin"
  566. Value="2" />
  567. <Setter Property="FontSize"
  568. Value="15" />
  569. <Setter Property="HorizontalContentAlignment"
  570. Value="Center" />
  571. <Setter Property="VerticalContentAlignment"
  572. Value="Center" />
  573. <Setter Property="Template">
  574. <Setter.Value>
  575. <ControlTemplate TargetType="{x:Type CalendarButton}">
  576. <Grid>
  577. <VisualStateManager.VisualStateGroups>
  578. <VisualStateGroup x:Name="CommonStates">
  579. <VisualStateGroup.Transitions>
  580. <VisualTransition GeneratedDuration="0:0:0.1" />
  581. </VisualStateGroup.Transitions>
  582. <VisualState x:Name="Normal" />
  583. <VisualState x:Name="MouseOver">
  584. <Storyboard>
  585. <DoubleAnimation Duration="0"
  586. To=".5"
  587. Storyboard.TargetProperty="Opacity"
  588. Storyboard.TargetName="Background" />
  589. </Storyboard>
  590. </VisualState>
  591. <VisualState x:Name="Pressed">
  592. <Storyboard>
  593. <DoubleAnimation Duration="0"
  594. To=".5"
  595. Storyboard.TargetProperty="Opacity"
  596. Storyboard.TargetName="Background" />
  597. </Storyboard>
  598. </VisualState>
  599. </VisualStateGroup>
  600. <VisualStateGroup x:Name="SelectionStates">
  601. <VisualStateGroup.Transitions>
  602. <VisualTransition GeneratedDuration="0" />
  603. </VisualStateGroup.Transitions>
  604. <VisualState x:Name="Unselected" />
  605. <VisualState x:Name="Selected">
  606. <Storyboard>
  607. <DoubleAnimation Duration="0"
  608. To=".75"
  609. Storyboard.TargetProperty="Opacity"
  610. Storyboard.TargetName="SelectedBackground" />
  611. </Storyboard>
  612. </VisualState>
  613. </VisualStateGroup>
  614. <VisualStateGroup x:Name="ActiveStates">
  615. <VisualStateGroup.Transitions>
  616. <VisualTransition GeneratedDuration="0" />
  617. </VisualStateGroup.Transitions>
  618. <VisualState x:Name="Active" />
  619. <VisualState x:Name="Inactive">
  620. <Storyboard>
  621. <ColorAnimation Duration="0"
  622. To="#FF777777"
  623. Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
  624. Storyboard.TargetName="NormalText" />
  625. </Storyboard>
  626. </VisualState>
  627. </VisualStateGroup>
  628. <VisualStateGroup x:Name="CalendarButtonFocusStates">
  629. <VisualStateGroup.Transitions>
  630. <VisualTransition GeneratedDuration="0" />
  631. </VisualStateGroup.Transitions>
  632. <VisualState x:Name="CalendarButtonFocused">
  633. <Storyboard>
  634. <ObjectAnimationUsingKeyFrames Duration="0"
  635. Storyboard.TargetProperty="Visibility"
  636. Storyboard.TargetName="CalendarButtonFocusVisual">
  637. <DiscreteObjectKeyFrame KeyTime="0">
  638. <DiscreteObjectKeyFrame.Value>
  639. <Visibility>Visible</Visibility>
  640. </DiscreteObjectKeyFrame.Value>
  641. </DiscreteObjectKeyFrame>
  642. </ObjectAnimationUsingKeyFrames>
  643. </Storyboard>
  644. </VisualState>
  645. <VisualState x:Name="CalendarButtonUnfocused">
  646. <Storyboard>
  647. <ObjectAnimationUsingKeyFrames Duration="0"
  648. Storyboard.TargetProperty="Visibility"
  649. Storyboard.TargetName="CalendarButtonFocusVisual">
  650. <DiscreteObjectKeyFrame KeyTime="0">
  651. <DiscreteObjectKeyFrame.Value>
  652. <Visibility>Collapsed</Visibility>
  653. </DiscreteObjectKeyFrame.Value>
  654. </DiscreteObjectKeyFrame>
  655. </ObjectAnimationUsingKeyFrames>
  656. </Storyboard>
  657. </VisualState>
  658. </VisualStateGroup>
  659. </VisualStateManager.VisualStateGroups>
  660. <Rectangle x:Name="SelectedBackground"
  661. Fill="{TemplateBinding Background}"
  662. Opacity="0"
  663. RadiusY="1"
  664. RadiusX="1" />
  665. <Rectangle x:Name="Background"
  666. Fill="{TemplateBinding Background}"
  667. Opacity="0"
  668. RadiusY="1"
  669. RadiusX="1" />
  670. <ContentPresenter x:Name="NormalText"
  671. TextElement.Foreground="#FF333333"
  672. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  673. Margin="1,0,1,1"
  674. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  675. <Rectangle x:Name="CalendarButtonFocusVisual"
  676. IsHitTestVisible="false"
  677. RadiusY="1"
  678. RadiusX="1"
  679. Stroke="{DynamicResource MuchinfoBrush3}"
  680. Visibility="Collapsed" />
  681. </Grid>
  682. <ControlTemplate.Triggers>
  683. <Trigger Property="IsFocused"
  684. Value="True">
  685. <Setter Property="Visibility"
  686. TargetName="CalendarButtonFocusVisual"
  687. Value="Visible" />
  688. </Trigger>
  689. </ControlTemplate.Triggers>
  690. </ControlTemplate>
  691. </Setter.Value>
  692. </Setter>
  693. </Style>
  694. <Style x:Key="CalendarStyle"
  695. TargetType="{x:Type Calendar}">
  696. <!--日历控件的背景色,也可以改成绑定的-->
  697. <Setter Property="Background"
  698. Value="{DynamicResource MuchinfoBrush83}" />
  699. <Setter Property="Template">
  700. <Setter.Value>
  701. <ControlTemplate TargetType="{x:Type Calendar}">
  702. <StackPanel x:Name="PART_Root"
  703. HorizontalAlignment="Center"
  704. VerticalAlignment="Center">
  705. <!--这个是日历控件的主体元件,也是内部元件PART_CalendarItem名称不要更改,可以改它的其它样式属性-->
  706. <CalendarItem x:Name="PART_CalendarItem"
  707. BorderBrush="{TemplateBinding BorderBrush}"
  708. BorderThickness="{TemplateBinding BorderThickness}"
  709. Background="{TemplateBinding Background}"
  710. Style="{TemplateBinding CalendarItemStyle}"
  711. Height="240"
  712. Width="240"
  713. HorizontalAlignment="Stretch"
  714. VerticalAlignment="Stretch" />
  715. </StackPanel>
  716. </ControlTemplate>
  717. </Setter.Value>
  718. </Setter>
  719. <Setter Property="CalendarItemStyle" Value="{StaticResource CalendarItemStyle}"/>
  720. <Setter Property="CalendarDayButtonStyle" Value="{StaticResource CalendarDayButtonStyle}"/>
  721. <Setter Property="CalendarButtonStyle" Value="{StaticResource CalendarButtonStyle}"/>
  722. </Style>
  723. </ResourceDictionary>