CalendarItem.axaml 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <ResourceDictionary xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:content="clr-namespace:SukiUI.Content">
  4. <ControlTheme x:Key="SukiCalendarItemStyle" TargetType="CalendarItem">
  5. <Setter Property="HorizontalAlignment" Value="Stretch" />
  6. <Setter Property="VerticalAlignment" Value="Stretch" />
  7. <Setter Property="DayTitleTemplate">
  8. <Template>
  9. <TextBlock HorizontalAlignment="Stretch"
  10. VerticalAlignment="Stretch"
  11. FontSize="12"
  12. Text="{Binding}"
  13. TextAlignment="Center" />
  14. </Template>
  15. </Setter>
  16. <Setter Property="Template">
  17. <ControlTemplate>
  18. <Border Background="{TemplateBinding Background}"
  19. BorderBrush="{TemplateBinding BorderBrush}"
  20. BorderThickness="{TemplateBinding BorderThickness}"
  21. CornerRadius="{DynamicResource ControlCornerRadius}">
  22. <Grid MinWidth="225"
  23. HorizontalAlignment="Stretch"
  24. VerticalAlignment="Stretch"
  25. RowDefinitions="Auto, *">
  26. <Grid Name="CalendarHeader"
  27. Margin="0,5"
  28. ColumnDefinitions="Auto, *, Auto, Auto">
  29. <Button Name="PART_HeaderButton"
  30. Grid.Column="0"
  31. Classes="Basic"
  32. FontWeight="{DynamicResource DefaultDemiBold}"
  33. IsEnabled="False" />
  34. <Button Name="PART_PreviousButton"
  35. Grid.Column="2"
  36. Classes="NavButton Basic">
  37. <PathIcon Classes="Primary Flippable" Data="{x:Static content:Icons.ChevronLeft}" />
  38. </Button>
  39. <Button Name="PART_NextButton"
  40. Grid.Column="3"
  41. Classes="NavButton Basic">
  42. <PathIcon Classes="Primary Flippable" Data="{x:Static content:Icons.ChevronRight}" />
  43. </Button>
  44. </Grid>
  45. <Grid Name="PART_MonthView"
  46. Grid.Row="1"
  47. Classes="CalendarView"
  48. ColumnDefinitions="32,32,32,32,32,32,32"
  49. RowDefinitions="32,32,32,32,32,32,32" />
  50. <Grid Name="PART_YearView"
  51. Grid.Row="1"
  52. Classes="CalendarView"
  53. ColumnDefinitions="*,*,*,*"
  54. RowDefinitions="*,*,*" />
  55. </Grid>
  56. </Border>
  57. </ControlTemplate>
  58. </Setter>
  59. <Style Selector="^ /template/ Button.NavButton">
  60. <Setter Property="Padding" Value="0" />
  61. <Setter Property="Margin" Value="0,0,18,0" />
  62. <Style Selector="^ &gt; PathIcon">
  63. <Setter Property="Width" Value="12" />
  64. <Setter Property="Height" Value="12" />
  65. </Style>
  66. </Style>
  67. <Style Selector="^ /template/ Button.HeaderButton">
  68. <Setter Property="Height" Value="24" />
  69. <Setter Property="TextElement.FontWeight" Value="{DynamicResource DefaultDemiBold}" />
  70. <Setter Property="Padding" Value="8, 0" />
  71. <Setter Property="HorizontalContentAlignment" Value="Left" />
  72. </Style>
  73. <Style Selector="^ /template/ Grid.CalendarView">
  74. <Setter Property="IsVisible" Value="False" />
  75. <Setter Property="MinWidth" Value="240" />
  76. <Setter Property="HorizontalAlignment" Value="Center" />
  77. <Setter Property="VerticalAlignment" Value="Center" />
  78. <Setter Property="MinHeight" Value="225" />
  79. <Setter Property="Row" Value="1" />
  80. </Style>
  81. </ControlTheme>
  82. <ControlTheme x:Key="{x:Type CalendarItem}"
  83. BasedOn="{StaticResource SukiCalendarItemStyle}"
  84. TargetType="CalendarItem" />
  85. </ResourceDictionary>