CalendarButton.axaml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <ControlTheme x:Key="SukiCalendarButtonStyle" TargetType="CalendarButton">
  3. <Setter Property="ClickMode" Value="Release" />
  4. <Setter Property="MinWidth" Value="55" />
  5. <Setter Property="MinHeight" Value="50" />
  6. <Setter Property="Foreground" Value="{DynamicResource SukiText}" />
  7. <Setter Property="Background" Value="{DynamicResource SukiPrimaryColor0}" />
  8. <Setter Property="BorderBrush" Value="{DynamicResource SukiBorderBrush}" />
  9. <Setter Property="CornerRadius" Value="{DynamicResource SmallCornerRadius}" />
  10. <Setter Property="ClipToBounds" Value="False" />
  11. <!-- <Setter Property="HorizontalAlignment" Value="Center" /> -->
  12. <Setter Property="VerticalAlignment" Value="Center" />
  13. <Setter Property="HorizontalContentAlignment" Value="Center" />
  14. <Setter Property="VerticalContentAlignment" Value="Center" />
  15. <Setter Property="Template">
  16. <ControlTemplate>
  17. <Panel>
  18. <Border Name="Root"
  19. Margin="5"
  20. Padding="5"
  21. Background="{TemplateBinding Background}"
  22. ClipToBounds="True"
  23. CornerRadius="{TemplateBinding CornerRadius}">
  24. <Border.Transitions>
  25. <Transitions>
  26. <BrushTransition Property="Background" Duration="{DynamicResource ShortAnimationDuration}" />
  27. </Transitions>
  28. </Border.Transitions>
  29. <ContentControl Name="Content"
  30. Margin="{TemplateBinding Padding}"
  31. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  32. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  33. Content="{TemplateBinding Content}"
  34. ContentTemplate="{TemplateBinding ContentTemplate}"
  35. FontSize="{TemplateBinding FontSize}" />
  36. </Border>
  37. </Panel>
  38. </ControlTemplate>
  39. </Setter>
  40. <Style Selector="^:pointerover">
  41. <Setter Property="Background" Value="{DynamicResource SukiPrimaryColor25}" />
  42. </Style>
  43. <Style Selector="^:pressed">
  44. <Setter Property="Background" Value="{DynamicResource SukiPrimaryColor75}" />
  45. </Style>
  46. <Style Selector="^:selected">
  47. <Setter Property="Background" Value="{DynamicResource SukiPrimaryColor50}" />
  48. <Setter Property="TextElement.FontWeight" Value="Bold" />
  49. </Style>
  50. <Style Selector="^:inactive /template/ Border#Root">
  51. <Setter Property="Opacity" Value="0.32" />
  52. </Style>
  53. <Style Selector="^:disabled /template/ ContentControl#Content">
  54. <Setter Property="Opacity" Value="0.32" />
  55. </Style>
  56. </ControlTheme>
  57. <ControlTheme x:Key="{x:Type CalendarButton}"
  58. BasedOn="{StaticResource SukiCalendarButtonStyle}"
  59. TargetType="CalendarButton" />
  60. </ResourceDictionary>