Browse Source

Tweaked DatePicker ControlTheme.

pull/8479/head
Steven Kirk 4 years ago
parent
commit
0d5b10ec3a
  1. 629
      src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml

629
src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml

@ -9,344 +9,349 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=netstandard" xmlns:sys="clr-namespace:System;assembly=netstandard"
x:CompileBindings="True"> x:CompileBindings="True">
<Design.PreviewWith> <Design.PreviewWith>
<Border Padding="20"> <Border Padding="20">
<DatePicker CornerRadius="10" /> <DatePicker CornerRadius="10" />
</Border> </Border>
</Design.PreviewWith> </Design.PreviewWith>
<Thickness x:Key="DatePickerTopHeaderMargin">0,0,0,4</Thickness> <Thickness x:Key="DatePickerTopHeaderMargin">0,0,0,4</Thickness>
<x:Double x:Key="DatePickerFlyoutPresenterHighlightHeight">40</x:Double> <x:Double x:Key="DatePickerFlyoutPresenterHighlightHeight">40</x:Double>
<x:Double x:Key="DatePickerFlyoutPresenterItemHeight">40</x:Double> <x:Double x:Key="DatePickerFlyoutPresenterItemHeight">40</x:Double>
<x:Double x:Key="DatePickerFlyoutPresenterAcceptDismissHostGridHeight">41</x:Double> <x:Double x:Key="DatePickerFlyoutPresenterAcceptDismissHostGridHeight">41</x:Double>
<x:Double x:Key="DatePickerThemeMinWidth">296</x:Double> <x:Double x:Key="DatePickerThemeMinWidth">296</x:Double>
<x:Double x:Key="DatePickerThemeMaxWidth">456</x:Double> <x:Double x:Key="DatePickerThemeMaxWidth">456</x:Double>
<Thickness x:Key="DatePickerFlyoutPresenterItemPadding">0,3,0,6</Thickness> <Thickness x:Key="DatePickerFlyoutPresenterItemPadding">0,3,0,6</Thickness>
<Thickness x:Key="DatePickerFlyoutPresenterMonthPadding">9,3,0,6</Thickness> <Thickness x:Key="DatePickerFlyoutPresenterMonthPadding">9,3,0,6</Thickness>
<Thickness x:Key="DatePickerHostPadding">0,3,0,6</Thickness> <Thickness x:Key="DatePickerHostPadding">0,3,0,6</Thickness>
<Thickness x:Key="DatePickerHostMonthPadding">9,3,0,6</Thickness> <Thickness x:Key="DatePickerHostMonthPadding">9,3,0,6</Thickness>
<x:Double x:Key="DatePickerSpacerThemeWidth">1</x:Double> <x:Double x:Key="DatePickerSpacerThemeWidth">1</x:Double>
<!-- Theme for the items displayed in the selectors --> <!-- Theme for the items displayed in the selectors -->
<ControlTheme x:Key="FluentDateTimePickerItem" TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> <ControlTheme x:Key="FluentDateTimePickerItem" TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="Padding" Value="{DynamicResource DatePickerFlyoutPresenterItemPadding}"/> <Setter Property="Padding" Value="{DynamicResource DatePickerFlyoutPresenterItemPadding}"/>
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" />
<Style Selector="^:selected"> <Style Selector="^:selected">
<Setter Property="IsHitTestVisible" Value="False"/> <Setter Property="IsHitTestVisible" Value="False"/>
<Style Selector="^/template/ Rectangle#PressedBackground"> <Style Selector="^/template/ Rectangle#PressedBackground">
<Setter Property="Fill" Value="Transparent"/> <Setter Property="Fill" Value="Transparent"/>
</Style>
<Style Selector="^/template/ ContentPresenter">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
</Style>
</Style> </Style>
<Style Selector="^.MonthItem"> <Style Selector="^/template/ ContentPresenter">
<Setter Property="Padding" Value="{DynamicResource DatePickerFlyoutPresenterMonthPadding}"/> <Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
<Setter Property="HorizontalContentAlignment" Value="Left" />
</Style> </Style>
</ControlTheme> </Style>
<Style Selector="^.MonthItem">
<Setter Property="Padding" Value="{DynamicResource DatePickerFlyoutPresenterMonthPadding}"/>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
</Style>
</ControlTheme>
<!-- This is used for both the accept/dismiss & repeatbuttons in the presenter--> <!-- This is used for both the accept/dismiss & repeatbuttons in the presenter-->
<ControlTheme x:Key="FluentDateTimePickerButton" TargetType="Button"> <ControlTheme x:Key="FluentDateTimePickerButton" TargetType="Button">
<Setter Property="Background" Value="{DynamicResource DateTimePickerFlyoutButtonBackground}" /> <Setter Property="Background" Value="{DynamicResource DateTimePickerFlyoutButtonBackground}" />
<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="Template"> <Setter Property="RenderTransform" Value="none" />
<ControlTemplate> <Setter Property="Template">
<!-- <ControlTemplate>
<!--
The background is doubled here for the loopingselector up/down repeat buttons The background is doubled here for the loopingselector up/down repeat buttons
that appear opaque. Not sure how MS does it though I suspect this is it that appear opaque. Not sure how MS does it though I suspect this is it
but source isn't MIT yet, so this is my solution --> but source isn't MIT yet, so this is my solution -->
<Border Background="{TemplateBinding Background}"> <Border Background="{TemplateBinding Background}">
<ContentPresenter x:Name="ContentPresenter" <ContentPresenter x:Name="ContentPresenter"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{DynamicResource DateTimePickerFlyoutButtonBorderBrush}" BorderBrush="{DynamicResource DateTimePickerFlyoutButtonBorderBrush}"
BorderThickness="{DynamicResource DateTimeFlyoutButtonBorderThickness}" BorderThickness="{DynamicResource DateTimeFlyoutButtonBorderThickness}"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
Foreground="{DynamicResource SystemControlHighlightAltBaseHighBrush}" Foreground="{DynamicResource SystemControlHighlightAltBaseHighBrush}"
ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplate="{TemplateBinding ContentTemplate}"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
CornerRadius="{TemplateBinding CornerRadius}"/> CornerRadius="{TemplateBinding CornerRadius}"/>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
<Style Selector="^:pointerover /template/ ContentPresenter"> <Style Selector="^:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource DateTimePickerFlyoutButtonBackgroundPointerOver}"/> <Setter Property="Background" Value="{DynamicResource DateTimePickerFlyoutButtonBackgroundPointerOver}"/>
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerFlyoutButtonBorderBrushPointerOver}"/> <Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerFlyoutButtonBorderBrushPointerOver}"/>
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerFlyoutButtonForegroundPointerOver}"/> <Setter Property="Foreground" Value="{DynamicResource DateTimePickerFlyoutButtonForegroundPointerOver}"/>
</Style> </Style>
<Style Selector="^:pressed /template/ ContentPresenter"> <Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource DateTimePickerFlyoutButtonBackgroundPressed}"/> <Setter Property="RenderTransform" Value="scale(0.98)" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerFlyoutButtonBorderBrushPressed}"/> </Style>
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerFlyoutButtonForegroundPressed}"/>
</Style>
</ControlTheme>
<ControlTheme x:Key="FluentDateTimePickerUpButton" TargetType="RepeatButton" BasedOn="{StaticResource FluentDateTimePickerButton}"> <Style Selector="^:pressed /template/ ContentPresenter">
<Setter Property="VerticalAlignment" Value="Top"/> <Setter Property="Background" Value="{DynamicResource DateTimePickerFlyoutButtonBackgroundPressed}"/>
<Setter Property="Height" Value="22" /> <Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerFlyoutButtonBorderBrushPressed}"/>
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="Foreground" Value="{DynamicResource DateTimePickerFlyoutButtonForegroundPressed}"/>
<Setter Property="Focusable" Value="False" /> </Style>
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}" /> </ControlTheme>
<Setter Property="Content">
<Template>
<Viewbox Height="10" Width="10" HorizontalAlignment="Center" VerticalAlignment="Center">
<Path Stroke="{Binding $parent[RepeatButton].Foreground}" StrokeThickness="1" Data="M 0,9 L 9,0 L 18,9"/>
</Viewbox>
</Template>
</Setter>
</ControlTheme>
<ControlTheme x:Key="FluentDateTimePickerDownButton" TargetType="RepeatButton" BasedOn="{StaticResource FluentDateTimePickerButton}"> <ControlTheme x:Key="FluentDateTimePickerUpButton" TargetType="RepeatButton" BasedOn="{StaticResource FluentDateTimePickerButton}">
<Setter Property="VerticalAlignment" Value="Bottom"/> <Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Height" Value="22" /> <Setter Property="Height" Value="22" />
<Setter Property="HorizontalAlignment" Value="Stretch" /> <Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Focusable" Value="False" /> <Setter Property="Focusable" Value="False" />
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}" /> <Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}" />
<Setter Property="Content"> <Setter Property="Content">
<Template> <Template>
<Viewbox Height="10" Width="10" HorizontalAlignment="Center" VerticalAlignment="Center"> <Viewbox Height="10" Width="10" HorizontalAlignment="Center" VerticalAlignment="Center">
<Path Stroke="{Binding $parent[RepeatButton].Foreground}" StrokeThickness="1" Data="M 0,0 L 9,9 L 18,0"/> <Path Stroke="{Binding $parent[RepeatButton].Foreground}" StrokeThickness="1" Data="M 0,9 L 9,0 L 18,9"/>
</Viewbox> </Viewbox>
</Template> </Template>
</Setter> </Setter>
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="{x:Type DatePicker}" TargetType="DatePicker"> <ControlTheme x:Key="FluentDateTimePickerDownButton" TargetType="RepeatButton" BasedOn="{StaticResource FluentDateTimePickerButton}">
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> <Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Foreground" Value="{DynamicResource DatePickerButtonForeground}" /> <Setter Property="Height" Value="22" />
<Setter Property="Background" Value="{DynamicResource DatePickerButtonBackground}"/> <Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="BorderBrush" Value="{DynamicResource DatePickerButtonBorderBrush}"/> <Setter Property="Focusable" Value="False" />
<Setter Property="BorderThickness" Value="1"/> <Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> <Setter Property="Content">
<Setter Property="HorizontalAlignment" Value="Left" /> <Template>
<Setter Property="VerticalAlignment" Value="Center" /> <Viewbox Height="10" Width="10" HorizontalAlignment="Center" VerticalAlignment="Center">
<Setter Property="Template"> <Path Stroke="{Binding $parent[RepeatButton].Foreground}" StrokeThickness="1" Data="M 0,0 L 9,9 L 18,0"/>
<ControlTemplate> </Viewbox>
<DataValidationErrors> </Template>
<Grid Name="LayoutRoot" Margin="{TemplateBinding Padding}" RowDefinitions="Auto,*"> </Setter>
<ContentPresenter Name="HeaderContentPresenter" Grid.Row="0" </ControlTheme>
Content="{TemplateBinding Header}"
Foreground="{DynamicResource DatePickerHeaderForeground}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
Margin="{DynamicResource DatePickerTopHeaderMargin}"
MaxWidth="{DynamicResource DatePickerThemeMaxWidth}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"/>
<Button Name="FlyoutButton" Grid.Row="1" <ControlTheme x:Key="{x:Type DatePicker}" TargetType="DatePicker">
Foreground="{TemplateBinding Foreground}" <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
Background="{TemplateBinding Background}" <Setter Property="Foreground" Value="{DynamicResource DatePickerButtonForeground}" />
BorderBrush="{TemplateBinding BorderBrush}" <Setter Property="Background" Value="{DynamicResource DatePickerButtonBackground}"/>
BorderThickness="{TemplateBinding BorderThickness}" <Setter Property="BorderBrush" Value="{DynamicResource DatePickerButtonBorderBrush}"/>
CornerRadius="{TemplateBinding CornerRadius}" <Setter Property="BorderThickness" Value="1"/>
IsEnabled="{TemplateBinding IsEnabled}" <Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
MinWidth="{DynamicResource DatePickerThemeMinWidth}" <Setter Property="HorizontalAlignment" Value="Left" />
MaxWidth="{DynamicResource DatePickerThemeMaxWidth}" <Setter Property="VerticalAlignment" Value="Center" />
HorizontalAlignment="Stretch" <Setter Property="Template">
VerticalAlignment="Stretch" <ControlTemplate>
HorizontalContentAlignment="Stretch" <DataValidationErrors>
VerticalContentAlignment="Stretch" <Grid Name="LayoutRoot" Margin="{TemplateBinding Padding}" RowDefinitions="Auto,*">
TemplatedControl.IsTemplateFocusTarget="True"> <ContentPresenter Name="HeaderContentPresenter" Grid.Row="0"
<Button.Template> Content="{TemplateBinding Header}"
<ControlTemplate> Foreground="{DynamicResource DatePickerHeaderForeground}"
<ContentPresenter Name="ContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}"
BorderBrush="{TemplateBinding BorderBrush}" Margin="{DynamicResource DatePickerTopHeaderMargin}"
Background="{TemplateBinding Background}" MaxWidth="{DynamicResource DatePickerThemeMaxWidth}"
BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="Stretch"
Content="{TemplateBinding Content}" VerticalAlignment="Top"/>
Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
CornerRadius="{TemplateBinding CornerRadius}"/>
</ControlTemplate>
</Button.Template>
<Grid Name="ButtonContentGrid" ColumnDefinitions="78*,Auto,132*,Auto,78*">
<TextBlock Name="DayText" Text="day" HorizontalAlignment="Center"
Padding="{DynamicResource DatePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
<TextBlock Name="MonthText" Text="month" TextAlignment="Left"
Padding="{DynamicResource DatePickerHostMonthPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
<TextBlock Name="YearText" Text="year" HorizontalAlignment="Center"
Padding="{DynamicResource DatePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
<Rectangle x:Name="FirstSpacer"
Fill="{DynamicResource DatePickerSpacerFill}"
HorizontalAlignment="Center"
Width="1"
Grid.Column="1" />
<Rectangle x:Name="SecondSpacer"
Fill="{DynamicResource DatePickerSpacerFill}"
HorizontalAlignment="Center"
Width="1"
Grid.Column="3" />
</Grid>
</Button>
<Popup Name="Popup" WindowManagerAddShadowHint="False" <Button Name="FlyoutButton" Grid.Row="1"
IsLightDismissEnabled="True" PlacementTarget="{TemplateBinding}" Foreground="{TemplateBinding Foreground}"
PlacementMode="Bottom"> Background="{TemplateBinding Background}"
<DatePickerPresenter Name="PickerPresenter" /> BorderBrush="{TemplateBinding BorderBrush}"
</Popup> BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
IsEnabled="{TemplateBinding IsEnabled}"
MinWidth="{DynamicResource DatePickerThemeMinWidth}"
MaxWidth="{DynamicResource DatePickerThemeMaxWidth}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
TemplatedControl.IsTemplateFocusTarget="True">
<Button.Template>
<ControlTemplate>
<ContentPresenter Name="ContentPresenter"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
CornerRadius="{TemplateBinding CornerRadius}"/>
</ControlTemplate>
</Button.Template>
<Grid Name="ButtonContentGrid" ColumnDefinitions="78*,Auto,132*,Auto,78*">
<TextBlock Name="DayText" Text="day" HorizontalAlignment="Center"
Padding="{DynamicResource DatePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
<TextBlock Name="MonthText" Text="month" TextAlignment="Left"
Padding="{DynamicResource DatePickerHostMonthPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
<TextBlock Name="YearText" Text="year" HorizontalAlignment="Center"
Padding="{DynamicResource DatePickerHostPadding}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
FontSize="{TemplateBinding FontSize}"/>
<Rectangle x:Name="FirstSpacer"
Fill="{DynamicResource DatePickerSpacerFill}"
HorizontalAlignment="Center"
Width="1"
Grid.Column="1" />
<Rectangle x:Name="SecondSpacer"
Fill="{DynamicResource DatePickerSpacerFill}"
HorizontalAlignment="Center"
Width="1"
Grid.Column="3" />
</Grid>
</Button>
</Grid> <Popup Name="Popup" WindowManagerAddShadowHint="False"
</DataValidationErrors> IsLightDismissEnabled="True" PlacementTarget="{TemplateBinding}"
</ControlTemplate> PlacementMode="Bottom">
</Setter> <DatePickerPresenter Name="PickerPresenter" />
</Popup>
<Style Selector="^:disabled /template/ Rectangle"> </Grid>
<Setter Property="Fill" Value="{DynamicResource DatePickerSpacerFillDisabled}"/> </DataValidationErrors>
</Style> </ControlTemplate>
</Setter>
<!-- Changes foreground for watermark text when SelectedDate is null--> <Style Selector="^:disabled /template/ Rectangle">
<Style Selector="^:hasnodate /template/ Button#FlyoutButton TextBlock"> <Setter Property="Fill" Value="{DynamicResource DatePickerSpacerFillDisabled}"/>
<Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForeground}"/> </Style>
</Style>
<Style Selector="^/template/ Button#FlyoutButton">
<Style Selector="^:pointerover">
<Setter Property="BorderBrush" Value="{DynamicResource DatePickerButtonBorderBrushPointerOver}"/>
<Setter Property="Background" Value="{DynamicResource DatePickerButtonBackgroundPointerOver}"/>
<Setter Property="Foreground" Value="{DynamicResource DatePickerButtonForegroundPointerOver}"/>
</Style>
<Style Selector="^:pressed"> <!-- Changes foreground for watermark text when SelectedDate is null-->
<Setter Property="BorderBrush" Value="{DynamicResource DatePickerButtonBorderBrushPressed}"/> <Style Selector="^:hasnodate /template/ Button#FlyoutButton TextBlock">
<Setter Property="Background" Value="{DynamicResource DatePickerButtonBackgroundPressed}"/> <Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForeground}"/>
<Setter Property="Foreground" Value="{DynamicResource DatePickerButtonForegroundPressed}"/> </Style>
</Style> <Style Selector="^/template/ Button#FlyoutButton">
<Style Selector="^:pointerover">
<Setter Property="BorderBrush" Value="{DynamicResource DatePickerButtonBorderBrushPointerOver}"/>
<Setter Property="Background" Value="{DynamicResource DatePickerButtonBackgroundPointerOver}"/>
<Setter Property="Foreground" Value="{DynamicResource DatePickerButtonForegroundPointerOver}"/>
</Style>
<Style Selector="^:disabled"> <Style Selector="^:pressed">
<Setter Property="BorderBrush" Value="{DynamicResource DatePickerButtonBorderBrushDisabled}"/> <Setter Property="BorderBrush" Value="{DynamicResource DatePickerButtonBorderBrushPressed}"/>
<Setter Property="Background" Value="{DynamicResource DatePickerButtonBackgroundDisabled}"/> <Setter Property="Background" Value="{DynamicResource DatePickerButtonBackgroundPressed}"/>
<Setter Property="Foreground" Value="{DynamicResource DatePickerButtonForegroundDisabled}"/> <Setter Property="Foreground" Value="{DynamicResource DatePickerButtonForegroundPressed}"/>
</Style>
</Style> </Style>
<Style Selector="^:error /template/ Button#FlyoutButton">
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlErrorTextForegroundBrush}"/> <Style Selector="^:disabled">
<Setter Property="BorderBrush" Value="{DynamicResource DatePickerButtonBorderBrushDisabled}"/>
<Setter Property="Background" Value="{DynamicResource DatePickerButtonBackgroundDisabled}"/>
<Setter Property="Foreground" Value="{DynamicResource DatePickerButtonForegroundDisabled}"/>
</Style> </Style>
</ControlTheme> </Style>
<Style Selector="^:error /template/ Button#FlyoutButton">
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlErrorTextForegroundBrush}"/>
</Style>
</ControlTheme>
<!--WinUI: DatePickerFlyoutPresenter--> <!--WinUI: DatePickerFlyoutPresenter-->
<ControlTheme x:Key="{x:Type DatePickerPresenter}" TargetType="DatePickerPresenter"> <ControlTheme x:Key="{x:Type DatePickerPresenter}" TargetType="DatePickerPresenter">
<Setter Property="Width" Value="296" /> <Setter Property="Width" Value="296" />
<Setter Property="MinWidth" Value="296" /> <Setter Property="MinWidth" Value="296" />
<Setter Property="MaxHeight" Value="398" /> <Setter Property="MaxHeight" Value="398" />
<Setter Property="FontWeight" Value="Normal" /> <Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" /> <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Background" Value="{DynamicResource DatePickerFlyoutPresenterBackground}" /> <Setter Property="Background" Value="{DynamicResource DatePickerFlyoutPresenterBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DatePickerFlyoutPresenterBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource DatePickerFlyoutPresenterBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource DateTimeFlyoutBorderThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource DateTimeFlyoutBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource OverlayCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource OverlayCornerRadius}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border Name="Background" Background="{TemplateBinding Background}" <Border Name="Background" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
Padding="{DynamicResource DateTimeFlyoutBorderPadding}" Padding="{DynamicResource DateTimeFlyoutBorderPadding}"
MaxHeight="398" CornerRadius="{TemplateBinding CornerRadius}"> MaxHeight="398" CornerRadius="{TemplateBinding CornerRadius}">
<Grid Name="ContentRoot" RowDefinitions="*,Auto"> <Grid Name="ContentRoot" RowDefinitions="*,Auto">
<Grid Name="PickerContainer"> <Grid Name="PickerContainer">
<Grid.Styles> <Grid.Styles>
<Style Selector="DateTimePickerPanel > ListBoxItem"> <Style Selector="DateTimePickerPanel > ListBoxItem">
<Setter Property="Theme" Value="{StaticResource FluentDateTimePickerItem}" /> <Setter Property="Theme" Value="{StaticResource FluentDateTimePickerItem}" />
</Style> </Style>
</Grid.Styles> </Grid.Styles>
<!--Column Definitions set in code, ignore here--> <!--Column Definitions set in code, ignore here-->
<Panel Name="MonthHost"> <Panel Name="MonthHost">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" <ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden"> VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="MonthSelector" <DateTimePickerPanel Name="MonthSelector"
PanelType="Month" PanelType="Month"
ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}" ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}"
ShouldLoop="True" /> ShouldLoop="True" />
</ScrollViewer> </ScrollViewer>
<RepeatButton Name="MonthUpButton" Theme="{StaticResource FluentDateTimePickerUpButton}"/> <RepeatButton Name="MonthUpButton" Theme="{StaticResource FluentDateTimePickerUpButton}"/>
<RepeatButton Name="MonthDownButton" Theme="{StaticResource FluentDateTimePickerDownButton}"/> <RepeatButton Name="MonthDownButton" Theme="{StaticResource FluentDateTimePickerDownButton}"/>
</Panel> </Panel>
<Panel Name="DayHost"> <Panel Name="DayHost">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" <ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden"> VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="DaySelector" <DateTimePickerPanel Name="DaySelector"
PanelType="Day" PanelType="Day"
ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}" ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}"
ShouldLoop="True" /> ShouldLoop="True" />
</ScrollViewer> </ScrollViewer>
<RepeatButton Name="DayUpButton" Theme="{StaticResource FluentDateTimePickerUpButton}"/> <RepeatButton Name="DayUpButton" Theme="{StaticResource FluentDateTimePickerUpButton}"/>
<RepeatButton Name="DayDownButton" Theme="{StaticResource FluentDateTimePickerDownButton}"/> <RepeatButton Name="DayDownButton" Theme="{StaticResource FluentDateTimePickerDownButton}"/>
</Panel> </Panel>
<Panel Name="YearHost"> <Panel Name="YearHost">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" <ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden"> VerticalScrollBarVisibility="Hidden">
<DateTimePickerPanel Name="YearSelector" <DateTimePickerPanel Name="YearSelector"
PanelType="Year" PanelType="Year"
ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}" ItemHeight="{DynamicResource DatePickerFlyoutPresenterItemHeight}"
ShouldLoop="False" /> ShouldLoop="False" />
</ScrollViewer> </ScrollViewer>
<RepeatButton Name="YearUpButton" Theme="{StaticResource FluentDateTimePickerUpButton}"/> <RepeatButton Name="YearUpButton" Theme="{StaticResource FluentDateTimePickerUpButton}"/>
<RepeatButton Name="YearDownButton" Theme="{StaticResource FluentDateTimePickerDownButton}"/> <RepeatButton Name="YearDownButton" Theme="{StaticResource FluentDateTimePickerDownButton}"/>
</Panel> </Panel>
<Rectangle Name="HighlightRect" IsHitTestVisible="False" ZIndex="-1" <Rectangle Name="HighlightRect" IsHitTestVisible="False" ZIndex="-1"
Fill="{DynamicResource DatePickerFlyoutPresenterHighlightFill}" Fill="{DynamicResource DatePickerFlyoutPresenterHighlightFill}"
Grid.Column="0" Grid.ColumnSpan="5" VerticalAlignment="Center" Grid.Column="0" Grid.ColumnSpan="5" VerticalAlignment="Center"
Height="{DynamicResource DatePickerFlyoutPresenterHighlightHeight}" /> Height="{DynamicResource DatePickerFlyoutPresenterHighlightHeight}" />
<Rectangle Name="FirstSpacer" <Rectangle Name="FirstSpacer"
Fill="{DynamicResource DatePickerFlyoutPresenterSpacerFill}" Fill="{DynamicResource DatePickerFlyoutPresenterSpacerFill}"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Width="{DynamicResource DatePickerSpacerThemeWidth}" Width="{DynamicResource DatePickerSpacerThemeWidth}"
Grid.Column="1" /> Grid.Column="1" />
<Rectangle Name="SecondSpacer" <Rectangle Name="SecondSpacer"
Fill="{DynamicResource DatePickerFlyoutPresenterSpacerFill}" Fill="{DynamicResource DatePickerFlyoutPresenterSpacerFill}"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Width="{DynamicResource DatePickerSpacerThemeWidth}" Width="{DynamicResource DatePickerSpacerThemeWidth}"
Grid.Column="3" /> Grid.Column="3" />
</Grid>
<Grid Grid.Row="1" Height="{DynamicResource DatePickerFlyoutPresenterAcceptDismissHostGridHeight}"
Name="AcceptDismissGrid" ColumnDefinitions="*,*">
<Rectangle Height="{DynamicResource DatePickerSpacerThemeWidth}" VerticalAlignment="Top"
Fill="{DynamicResource DatePickerFlyoutPresenterSpacerFill}"
Grid.ColumnSpan="2"/>
<Button Name="AcceptButton" Grid.Column="0" Theme="{StaticResource FluentDateTimePickerButton}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Path Stroke="{Binding $parent[Button].Foreground}" StrokeLineCap="Round"
StrokeThickness="0.75" Data="M0.5,8.5 5,13.5 15.5,3" />
</Button>
<Button Name="DismissButton" Grid.Column="1" Theme="{StaticResource FluentDateTimePickerButton}"
FontSize="16" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Path Stroke="{Binding $parent[Button].Foreground}" StrokeLineCap="Round"
StrokeThickness="0.75" Data="M2,2 14,14 M2,14 14 2" />
</Button>
</Grid>
</Grid> </Grid>
</Border> <Grid Grid.Row="1" Height="{DynamicResource DatePickerFlyoutPresenterAcceptDismissHostGridHeight}"
</ControlTemplate> Name="AcceptDismissGrid" ColumnDefinitions="*,*">
</Setter> <Rectangle Height="{DynamicResource DatePickerSpacerThemeWidth}" VerticalAlignment="Top"
Fill="{DynamicResource DatePickerFlyoutPresenterSpacerFill}"
Grid.ColumnSpan="2"/>
<Button Name="AcceptButton" Grid.Column="0" Theme="{StaticResource FluentDateTimePickerButton}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Path Stroke="{Binding $parent[Button].Foreground}" StrokeLineCap="Round"
StrokeThickness="0.75" Data="M0.5,8.5 5,13.5 15.5,3" />
</Button>
<Button Name="DismissButton" Grid.Column="1" Theme="{StaticResource FluentDateTimePickerButton}"
FontSize="16" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Path Stroke="{Binding $parent[Button].Foreground}" StrokeLineCap="Round"
StrokeThickness="0.75" Data="M2,2 14,14 M2,14 14 2" />
</Button>
</Grid>
</Grid>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ Panel"> <Style Selector="^ /template/ Panel">
<Style Selector="^ RepeatButton"> <Style Selector="^ RepeatButton">
<Setter Property="IsVisible" Value="False" /> <Setter Property="IsVisible" Value="False" />
</Style> </Style>
<Style Selector="^:pointerover RepeatButton"> <Style Selector="^:pointerover RepeatButton">
<Setter Property="IsVisible" Value="True" /> <Setter Property="IsVisible" Value="True" />
</Style> </Style>
</Style> </Style>
</ControlTheme> </ControlTheme>
</ResourceDictionary> </ResourceDictionary>

Loading…
Cancel
Save