CalendarDatePickerStyle.axaml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <ResourceDictionary xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:sys="using:System"
  4. xmlns:suki="https://github.com/kikipoulet/SukiUI"
  5. x:ClassModifier="internal">
  6. <Design.PreviewWith>
  7. <Border Width="800"
  8. Height="800"
  9. Padding="50">
  10. <CalendarDatePicker />
  11. </Border>
  12. </Design.PreviewWith>
  13. <ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker">
  14. <Setter Property="Background" Value="Transparent" />
  15. <Setter Property="Height" Value="38" />
  16. <Setter Property="BorderThickness" Value="0,0,0,1" />
  17. <Setter Property="FontSize" Value="14" />
  18. <Setter Property="BorderBrush" Value="{DynamicResource SukiControlBorderBrush}" />
  19. <Setter Property="Padding" Value="4" />
  20. <Setter Property="VerticalContentAlignment" Value="Center" />
  21. <Setter Property="Template">
  22. <ControlTemplate>
  23. <suki:GlassCard Height="{TemplateBinding Height}" CornerRadius="{DynamicResource SmallCornerRadius}" Classes="Discrete" >
  24. <Grid ColumnDefinitions="*,Auto">
  25. <Grid.Styles>
  26. <Style Selector="Button.CalendarDropDown">
  27. <Setter Property="Template">
  28. <ControlTemplate>
  29. <Grid Width="22"
  30. Height="20"
  31. Margin="0,0,16,0"
  32. HorizontalAlignment="Center"
  33. VerticalAlignment="Center"
  34. Background="Transparent"
  35. ClipToBounds="False"
  36. ColumnDefinitions="*,*,*,*"
  37. RowDefinitions="23*,19*,19*,19*">
  38. <Border Name="Background"
  39. Grid.Row="1"
  40. Grid.RowSpan="3"
  41. Grid.Column="0"
  42. Grid.ColumnSpan="4"
  43. Margin="0,-1,0,0"
  44. BorderBrush="{DynamicResource SukiControlBorderBrush}"
  45. BorderThickness="1"
  46. CornerRadius="0,0,2,2" />
  47. <Border Grid.Row="0"
  48. Grid.Column="0"
  49. Grid.ColumnSpan="4"
  50. Background="{DynamicResource SukiPrimaryColor}"
  51. BorderBrush="{DynamicResource SukiControlBorderBrush}"
  52. BorderThickness="1"
  53. CornerRadius="3,3,0,0" />
  54. <TextBlock Grid.Row="1"
  55. Grid.RowSpan="3"
  56. Grid.Column="0"
  57. Grid.ColumnSpan="4"
  58. Margin="0,-1,0,0"
  59. HorizontalAlignment="Center"
  60. VerticalAlignment="Center"
  61. FontSize="{DynamicResource FontSizeSmall}"
  62. Foreground="{DynamicResource SukiLowText}"
  63. Text="{Binding Source={x:Static sys:DateTime.Today}, Path=Day}" />
  64. <Ellipse Grid.Row="0"
  65. Grid.Column="0"
  66. Grid.ColumnSpan="4"
  67. Width="2"
  68. Height="2"
  69. HorizontalAlignment="Center"
  70. VerticalAlignment="Center"
  71. Fill="{DynamicResource SukiControlBorderBrush}"
  72. StrokeThickness="0" />
  73. </Grid>
  74. </ControlTemplate>
  75. </Setter>
  76. </Style>
  77. <Style Selector="Button.CalendarDropDown:pointerover /template/ Border#Background">
  78. <Setter Property="Background" Value="{DynamicResource SukiPrimaryColor5}" />
  79. </Style>
  80. </Grid.Styles>
  81. <TextBox Name="PART_TextBox" Classes="NoShadow"
  82. Grid.Column="0"
  83. Padding="{TemplateBinding Padding}"
  84. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  85. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  86. Background="{TemplateBinding Background}"
  87. BorderBrush="{TemplateBinding BorderBrush}"
  88. BorderThickness="{TemplateBinding BorderThickness}"
  89. CornerRadius="{TemplateBinding CornerRadius}"
  90. DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
  91. UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
  92. Watermark="{TemplateBinding Watermark}" />
  93. <Button Name="PART_Button"
  94. Grid.Column="1"
  95. Width="20"
  96. Margin="6,0"
  97. Padding="0"
  98. Background="Transparent"
  99. BorderThickness="0"
  100. Classes="CalendarDropDown"
  101. ClipToBounds="False"
  102. Focusable="False"
  103. Foreground="{TemplateBinding Foreground}" />
  104. <Popup Name="PART_Popup"
  105. Grid.Column="0" Topmost="False"
  106. IsLightDismissEnabled="True"
  107. PlacementTarget="{TemplateBinding}">
  108. <Border Margin="15"
  109. Background="{DynamicResource SukiStrongBackground}"
  110. BoxShadow="{DynamicResource SukiPopupShadow}"
  111. CornerRadius="14">
  112. <Border CornerRadius="14" ClipToBounds="True">
  113. <Panel Background="{DynamicResource PopupGradientBrush}">
  114. <Calendar Margin="15,8,8,12" Name="PART_Calendar"
  115. DisplayDate="{TemplateBinding DisplayDate}"
  116. DisplayDateEnd="{TemplateBinding DisplayDateEnd}"
  117. DisplayDateStart="{TemplateBinding DisplayDateStart}"
  118. FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
  119. Foreground="{DynamicResource SukiText}"
  120. IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
  121. SelectedDate="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedDate, Mode=TwoWay}" />
  122. </Panel>
  123. </Border>
  124. </Border>
  125. </Popup>
  126. </Grid>
  127. </suki:GlassCard>
  128. </ControlTemplate>
  129. </Setter>
  130. <Style Selector="^:focus /template/ TextBox#PART_TextBox">
  131. <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
  132. </Style>
  133. </ControlTheme>
  134. </ResourceDictionary>