Browse Source

Fluent Calendar Style

pull/4028/head
amwx 6 years ago
parent
commit
3b48112e1d
  1. 2
      src/Avalonia.Themes.Fluent/Calendar.xaml
  2. 9
      src/Avalonia.Themes.Fluent/CalendarButton.xaml
  3. 14
      src/Avalonia.Themes.Fluent/CalendarDayButton.xaml
  4. 2
      src/Avalonia.Themes.Fluent/CalendarItem.xaml

2
src/Avalonia.Themes.Fluent/Calendar.xaml

@ -5,7 +5,7 @@
// All other rights reserved. // All other rights reserved.
--> -->
<Styles xmlns="https://github.com/avaloniaui"> <Styles xmlns="https://github.com/avaloniaui">
<Style Selector="Calendar"> <Style Selector="Calendar">
<Setter Property="Foreground" Value="{DynamicResource CalendarViewForeground}" /> <Setter Property="Foreground" Value="{DynamicResource CalendarViewForeground}" />
<Setter Property="Background" Value="{DynamicResource CalendarViewBackground}" /> <Setter Property="Background" Value="{DynamicResource CalendarViewBackground}" />

9
src/Avalonia.Themes.Fluent/CalendarButton.xaml

@ -22,8 +22,9 @@
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Panel> <Panel>
<!-- To mimic WinUI SystemFocusVisual, Focus visual is drawn outside the bounds of the item -->
<Border Name="Root" Background="{TemplateBinding Background}" <Border Name="Root" Background="{TemplateBinding Background}"
BorderThickness="0" CornerRadius="2" ClipToBounds="True"> BorderThickness="0" CornerRadius="{DynamicResource ControlCornerRadius}" ClipToBounds="True">
<ContentControl Name="Content" <ContentControl Name="Content"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
@ -40,12 +41,14 @@
<Border Name="Border" <Border Name="Border"
BorderThickness="2" BorderThickness="2"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="2"/> CornerRadius="{DynamicResource ControlCornerRadius}"/>
<!--Removed for now...WinUI doesn't have selection follow focus, and only uses
focus visual w/ keyboard focus
<Border Name="FocusVisual" BorderThickness="2" <Border Name="FocusVisual" BorderThickness="2"
BorderBrush="{DynamicResource SystemControlHighlightBaseHighBrush}" BorderBrush="{DynamicResource SystemControlHighlightBaseHighBrush}"
IsHitTestVisible="False" IsHitTestVisible="False"
Margin="-1" CornerRadius="2"/> Margin="-2" CornerRadius="{DynamicResource ControlCornerRadius}"/>-->
</Panel> </Panel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>

14
src/Avalonia.Themes.Fluent/CalendarDayButton.xaml

@ -22,11 +22,9 @@
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Panel> <Panel>
<!-- To mimic WinUI SystemFocusVisual <!-- To mimic WinUI SystemFocusVisual, Focus visual is drawn outside the bounds of the item -->
Focus visual is drawn outside the bounds of the item
-->
<Border Name="Root" Background="{TemplateBinding Background}" <Border Name="Root" Background="{TemplateBinding Background}"
BorderThickness="0" CornerRadius="2" ClipToBounds="True"> BorderThickness="0" CornerRadius="{DynamicResource ControlCornerRadius}" ClipToBounds="True">
<ContentControl Name="Content" <ContentControl Name="Content"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
@ -43,14 +41,14 @@
<Border Name="Border" <Border Name="Border"
BorderThickness="2" BorderThickness="2"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="2"/> CornerRadius="{DynamicResource ControlCornerRadius}"/>
<!--Removed for now...WinUI doesn't have selection follow focus, and it leads to <!--Removed for now...WinUI doesn't have selection follow focus, and only uses
an undesired effect with both borders displayed focus visual w/ keyboard focus
<Border Name="FocusVisual" BorderThickness="2" <Border Name="FocusVisual" BorderThickness="2"
BorderBrush="{DynamicResource SystemControlHighlightBaseHighBrush}" BorderBrush="{DynamicResource SystemControlHighlightBaseHighBrush}"
IsHitTestVisible="False" IsHitTestVisible="False"
Margin="-1" CornerRadius="2"/>--> Margin="-2" CornerRadius="2"/>-->
</Panel> </Panel>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>

2
src/Avalonia.Themes.Fluent/CalendarItem.xaml

@ -21,7 +21,7 @@
<Border BorderThickness="{TemplateBinding BorderThickness}" <Border BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="2"> CornerRadius="{DynamicResource ControlCornerRadius}">
<Border.Styles> <Border.Styles>
<Style Selector="Button.CalendarHeader"> <Style Selector="Button.CalendarHeader">
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalAlignment" Value="Stretch" />

Loading…
Cancel
Save