Files
Ursa.Avalonia/src/Ursa.Themes.Semi/Controls/Calendar.axaml

293 lines
17 KiB
XML

<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<Design.PreviewWith>
<ThemeVariantScope RequestedThemeVariant="Dark">
<StackPanel Width="600" Height="400">
<u:DatePicker HorizontalAlignment="Stretch" />
<u:DateRangePicker />
</StackPanel>
</ThemeVariantScope>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type u:CalendarDayButton}" TargetType="u:CalendarDayButton">
<Setter Property="MinWidth" Value="{DynamicResource CalenderDayMinWidth}" />
<Setter Property="MinHeight" Value="{DynamicResource CalenderDayMinHeight}" />
<Setter Property="Margin" Value="{DynamicResource CalenderDayMargin}" />
<Setter Property="Foreground" Value="{DynamicResource CalendarItemCalendarDayButtonForeground}" />
<Setter Property="Background" Value="{DynamicResource CalenderDayBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CalenderDayBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource CalenderDayBorderThickness}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="CornerRadius" Value="{DynamicResource CalenderDayCornerRadius}" />
<Setter Property="Template">
<ControlTemplate TargetType="u:CalendarDayButton">
<Panel>
<Border
Name="PART_Background"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter
Name="PART_ContentPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</Border>
</Panel>
</ControlTemplate>
</Setter>
<Style Selector="^:in-range">
<Setter Property="Background" Value="{DynamicResource CalenderDayInRangeBackground}" />
<Setter Property="CornerRadius" Value="{DynamicResource CalenderDayInRangeCornerRadius}" />
<Setter Property="BorderThickness" Value="{DynamicResource CalenderDayNoBorderThickness}" />
<Setter Property="Foreground" Value="{DynamicResource CalenderDaySelectedForeground}" />
</Style>
<Style Selector="^:today">
<Setter Property="Background" Value="{DynamicResource CalenderDayTodayBackground}" />
<Setter Property="Foreground" Value="{DynamicResource CalenderDayTodayForeground}" />
<Setter Property="Cursor" Value="Hand" />
<Style Selector="^:in-range">
<Setter Property="Background" Value="{DynamicResource CalenderDayInRangeBackground}" />
</Style>
</Style>
<Style Selector="^:not-current-month">
<Setter Property="Foreground" Value="{DynamicResource CalenderDayNotCurrentMonthForeground}" />
</Style>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource CalenderDayPointeroverBackground}" />
<Setter Property="Cursor" Value="Hand" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource CalenderDayPressedBackground}" />
</Style>
<Style Selector="^:selected">
<Setter Property="Background" Value="{DynamicResource CalenderDaySelectedBackground}" />
<Setter Property="CornerRadius" Value="{DynamicResource CalenderDayCornerRadius}" />
<Setter Property="BorderThickness" Value="{DynamicResource CalenderDayNoBorderThickness}" />
<Setter Property="Foreground" Value="{DynamicResource CalenderDaySelectedForeground}" />
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource CalenderDaySelectedPointeroverBackground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource CalenderDaySelectedPressedBackground}" />
</Style>
</Style>
<Style Selector="^:start-date">
<Setter Property="CornerRadius" Value="{DynamicResource CalenderDayStartDateCornerRadius}" />
<Setter Property="Background" Value="{DynamicResource CalenderDayStartEndDateBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CalenderDayStartEndDateBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource CalenderDaySelectedForeground}" />
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource CalenderDayStartEndDatePointeroverBackground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource CalenderDayStartEndDatePressedBackground}" />
</Style>
<Style Selector="^:in-range">
<Setter Property="BorderBrush" Value="{DynamicResource CalenderDayStartEndDateInRangeBackground}" />
<Setter Property="BorderThickness" Value="{DynamicResource CalenderDayBorderThickness}" />
</Style>
</Style>
<Style Selector="^:end-date">
<Setter Property="CornerRadius" Value="{DynamicResource CalenderDayEndDateCornerRadius}" />
<Setter Property="Background" Value="{DynamicResource CalenderDayStartEndDateBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CalenderDayStartEndDateBorderBrush}" />
<Setter Property="Foreground" Value="{DynamicResource CalenderDaySelectedForeground}" />
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource CalenderDayStartEndDatePointeroverBackground}" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource CalenderDayStartEndDatePressedBackground}" />
</Style>
<Style Selector="^:in-range">
<Setter Property="BorderBrush" Value="{DynamicResource CalenderDayStartEndDateInRangeBackground}" />
<Setter Property="BorderThickness" Value="{DynamicResource CalenderDayBorderThickness}" />
</Style>
</Style>
<Style Selector="^:preview-start-date">
<Setter Property="CornerRadius" Value="{DynamicResource CalenderDayStartDateCornerRadius}" />
<Setter Property="Background" Value="{DynamicResource CalenderDayPreviewStartEndDateBackground}" />
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource CalenderDayPreviewStartEndDatePressedBackground}" />
</Style>
</Style>
<Style Selector="^:preview-end-date">
<Setter Property="CornerRadius" Value="{DynamicResource CalenderDayEndDateCornerRadius}" />
<Setter Property="Background" Value="{DynamicResource CalenderDayPreviewStartEndDateBackground}" />
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource CalenderDayPreviewStartEndDatePressedBackground}" />
</Style>
</Style>
<Style Selector="^:blackout">
<Setter Property="Foreground" Value="{DynamicResource CalenderDayBlackoutForeground}" />
<Setter Property="Background" Value="{DynamicResource CalenderDayBlackoutBackground}" />
<Setter Property="Cursor" Value="No" />
<Style Selector="^:today">
<Setter Property="Foreground" Value="{DynamicResource CalenderDayBlackoutTodayBackground}" />
</Style>
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type u:CalendarYearButton}" TargetType="u:CalendarYearButton">
<Setter Property="MinWidth" Value="{DynamicResource CalenderYearMinWidth}" />
<Setter Property="MinHeight" Value="{DynamicResource CalenderYearMinHeight}" />
<Setter Property="Margin" Value="{DynamicResource CalenderYearMargin}" />
<Setter Property="Background" Value="{DynamicResource CalenderYearBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CalenderYearBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource CalenderYearBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource CalenderYearCornerRadius}" />
<Setter Property="Template">
<ControlTemplate TargetType="u:CalendarDayButton">
<Panel>
<Border
Name="PART_Background"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter
Name="PART_ContentPresenter"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</Border>
</Panel>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource CalenderYearPointeroverBackground}" />
<Setter Property="Cursor" Value="Hand" />
</Style>
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource CalenderYearPressedBackground}" />
</Style>
<Style Selector="^:selected">
<Setter Property="Background" Value="{DynamicResource CalenderYearSelectedBackground}" />
<Setter Property="CornerRadius" Value="{DynamicResource CalenderYearCornerRadius}" />
<Setter Property="BorderThickness" Value="{DynamicResource CalenderYearSelectedBorderThickness}" />
<Setter Property="Foreground" Value="{DynamicResource CalenderYearSelectedForeground}" />
<Style Selector="^:pointerover">
<Setter Property="Background" Value="{DynamicResource CalenderYearSelectedPointeroverBackground}" />
</Style>
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type u:CalendarView}" TargetType="u:CalendarView">
<Setter Property="MinHeight" Value="{DynamicResource CalenderViewMinWidth}" />
<Setter Property="MinWidth" Value="{DynamicResource CalenderViewMinHeight}" />
<Setter Property="Background" Value="{DynamicResource DatePickerViewBackground}" />
<Setter Property="Template">
<ControlTemplate TargetType="u:CalendarView">
<Grid Background="{TemplateBinding Background}" RowDefinitions="Auto, *">
<Grid
Grid.Row="0"
Margin="0,0,0,16"
ColumnDefinitions="Auto, Auto,*, Auto, Auto">
<Button
Name="{x:Static u:CalendarView.PART_FastPreviousButton}"
Grid.Column="0"
HorizontalContentAlignment="Left"
Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Width="{DynamicResource CalenderViewPathIconWidth}"
Height="{DynamicResource CalenderViewPathIconHeight}"
Data="{DynamicResource CalendarViewFastForwardGlyph}"
Foreground="{DynamicResource CalendarItemIconForeground}" />
</Button>
<Button
Name="{x:Static u:CalendarView.PART_PreviousButton}"
Grid.Column="1"
HorizontalContentAlignment="Left"
Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Width="{DynamicResource CalenderViewPathIconWidth}"
Height="{DynamicResource CalenderViewPathIconHeight}"
Data="{DynamicResource CalendarItemPreviousIconGlyph}"
Foreground="{DynamicResource CalendarItemIconForeground}" />
</Button>
<Grid Grid.Column="2" ColumnDefinitions="*, *">
<Button
Name="{x:Static u:CalendarView.PART_YearButton}"
Grid.Column="0"
HorizontalContentAlignment="Center"
Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}" />
<Button
Name="{x:Static u:CalendarView.PART_MonthButton}"
Grid.Column="1"
HorizontalContentAlignment="Center"
Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}" />
<Button
Name="{x:Static u:CalendarView.PART_HeaderButton}"
Grid.Column="0"
Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
IsVisible="True" />
</Grid>
<Button
Name="{x:Static u:CalendarView.PART_NextButton}"
Grid.Column="3"
HorizontalContentAlignment="Left"
Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Width="{DynamicResource CalenderViewPathIconWidth}"
Height="{DynamicResource CalenderViewPathIconHeight}"
Data="{DynamicResource CalendarItemNextIconGlyph}"
Foreground="{DynamicResource CalendarItemIconForeground}" />
</Button>
<Button
Name="{x:Static u:CalendarView.PART_FastNextButton}"
Grid.Column="4"
HorizontalContentAlignment="Left"
Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}">
<PathIcon
Width="{DynamicResource CalenderViewPathIconWidth}"
Height="{DynamicResource CalenderViewPathIconHeight}"
Data="{DynamicResource CalendarViewFastBackwardGlyph}"
Foreground="{DynamicResource CalendarItemIconForeground}" />
</Button>
</Grid>
<Grid
Name="{x:Static u:CalendarView.PART_MonthGrid}"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ColumnDefinitions="*, *, *, *, *, *, *"
RowDefinitions="*, Auto, *, *, *, *, *, *" />
<Grid
Name="{x:Static u:CalendarView.PART_YearGrid}"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ColumnDefinitions="*, *, *"
RowDefinitions="*, *, *, *" />
</Grid>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>