269 lines
15 KiB
XML
269 lines
15 KiB
XML
<ResourceDictionary
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
x:CompileBindings="True">
|
|
<ControlTheme x:Key="{x:Type DatePickerPresenter}" TargetType="DatePickerPresenter">
|
|
<Setter Property="Width" Value="296" />
|
|
<Setter Property="MinWidth" Value="296" />
|
|
<Setter Property="MaxHeight" Value="300" />
|
|
<Setter Property="FontWeight" Value="Normal" />
|
|
<Setter Property="Background" Value="{DynamicResource DateTimePickerPopupBackground}" />
|
|
<Setter Property="CornerRadius" Value="6" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate TargetType="DatePickerPresenter">
|
|
<Border
|
|
Name="Background"
|
|
Margin="{DynamicResource DateTimePickerFlyoutBorderMargin}"
|
|
Padding="{DynamicResource DateTimePickerFlyoutPadding}"
|
|
HorizontalAlignment="Stretch"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
BoxShadow="{DynamicResource DateTimePickerFlyoutBoxShadow}"
|
|
CornerRadius="{TemplateBinding CornerRadius}">
|
|
<Grid Name="ContentPanel" RowDefinitions="*,Auto">
|
|
<Grid Name="PART_PickerContainer">
|
|
<Grid.Styles>
|
|
<Style Selector="DateTimePickerPanel > ListBoxItem">
|
|
<Setter Property="Theme" Value="{StaticResource DateTimePickerItem}" />
|
|
</Style>
|
|
</Grid.Styles>
|
|
<!-- Column Definitions set in code, ignore here -->
|
|
<Panel Name="PART_MonthHost">
|
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden">
|
|
<DateTimePickerPanel
|
|
Name="PART_MonthSelector"
|
|
ItemHeight="{DynamicResource DateTimePickerListBoxItemHeight}"
|
|
PanelType="Month"
|
|
ShouldLoop="True" />
|
|
</ScrollViewer>
|
|
<RepeatButton Name="PART_MonthUpButton" Theme="{StaticResource DateTimePickerUpButton}" />
|
|
<RepeatButton Name="PART_MonthDownButton" Theme="{StaticResource DateTimePickerDownButton}" />
|
|
</Panel>
|
|
<Panel Name="PART_DayHost">
|
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden">
|
|
<DateTimePickerPanel
|
|
Name="PART_DaySelector"
|
|
ItemHeight="{DynamicResource DateTimePickerListBoxItemHeight}"
|
|
PanelType="Day"
|
|
ShouldLoop="True" />
|
|
</ScrollViewer>
|
|
<RepeatButton Name="PART_DayUpButton" Theme="{StaticResource DateTimePickerUpButton}" />
|
|
<RepeatButton Name="PART_DayDownButton" Theme="{StaticResource DateTimePickerDownButton}" />
|
|
</Panel>
|
|
<Panel Name="PART_YearHost">
|
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden">
|
|
<DateTimePickerPanel
|
|
Name="PART_YearSelector"
|
|
ItemHeight="{DynamicResource DateTimePickerListBoxItemHeight}"
|
|
PanelType="Year"
|
|
ShouldLoop="False" />
|
|
</ScrollViewer>
|
|
<RepeatButton Name="PART_YearUpButton" Theme="{StaticResource DateTimePickerUpButton}" />
|
|
<RepeatButton Name="PART_YearDownButton" Theme="{StaticResource DateTimePickerDownButton}" />
|
|
</Panel>
|
|
<Rectangle
|
|
Name="PART_FirstSpacer"
|
|
Grid.Column="1"
|
|
Width="1"
|
|
Margin="0,4"
|
|
HorizontalAlignment="Center"
|
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
|
<Rectangle
|
|
Name="PART_SecondSpacer"
|
|
Grid.Column="3"
|
|
Width="1"
|
|
Margin="0,4"
|
|
HorizontalAlignment="Center"
|
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
|
</Grid>
|
|
|
|
<Grid
|
|
Name="AcceptDismissGrid"
|
|
Grid.Row="1"
|
|
ColumnDefinitions="*,*">
|
|
<Button
|
|
Name="PART_AcceptButton"
|
|
Grid.Column="0"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Theme="{StaticResource DateTimePickerButton}">
|
|
<PathIcon
|
|
Width="12"
|
|
Height="12"
|
|
Data="{DynamicResource DateTimePickerAcceptGlyph}" />
|
|
</Button>
|
|
<Button
|
|
Name="PART_DismissButton"
|
|
Grid.Column="1"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
FontSize="16"
|
|
Theme="{StaticResource DateTimePickerButton}">
|
|
<PathIcon
|
|
Width="12"
|
|
Height="12"
|
|
Data="{DynamicResource DateTimePickerDismissGlyph}" />
|
|
</Button>
|
|
<Rectangle
|
|
Grid.ColumnSpan="2"
|
|
Height="1"
|
|
VerticalAlignment="Top"
|
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
|
|
<Style Selector="^ /template/ Panel">
|
|
<Style Selector="^:pointerover RepeatButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
</Style>
|
|
</Style>
|
|
</ControlTheme>
|
|
|
|
<ControlTheme x:Key="{x:Type DatePicker}" TargetType="DatePicker">
|
|
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonForeground}" />
|
|
<Setter Property="Background" Value="{DynamicResource DateTimePickerButtonBackground}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonBorderBrush}" />
|
|
<Setter Property="BorderThickness" Value="{DynamicResource DateTimePickerButtonBorderThickness}" />
|
|
<Setter Property="CornerRadius" Value="{DynamicResource DateTimePickerButtonCornerRadius}" />
|
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonDefaultHeight}" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate TargetType="DatePicker">
|
|
<DataValidationErrors>
|
|
<Grid
|
|
Name="LayoutRoot"
|
|
Margin="{TemplateBinding Padding}"
|
|
ColumnDefinitions="*, Auto">
|
|
<Button
|
|
Name="PART_FlyoutButton"
|
|
Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Width="298"
|
|
MinWidth="298"
|
|
MinHeight="{TemplateBinding MinHeight}"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding CornerRadius}"
|
|
Cursor="Hand"
|
|
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
|
Foreground="{TemplateBinding Foreground}"
|
|
IsEnabled="{TemplateBinding IsEnabled}"
|
|
Theme="{StaticResource DateTimePickerFlyoutButton}">
|
|
<Grid ColumnDefinitions="*, Auto">
|
|
<Grid
|
|
Name="PART_ButtonContentGrid"
|
|
Grid.Column="0"
|
|
VerticalAlignment="Center"
|
|
ColumnDefinitions="78*,Auto,132*,Auto,78*">
|
|
<TextBlock
|
|
Name="PART_DayTextBlock"
|
|
Padding="12,0"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
FontFamily="{TemplateBinding FontFamily}"
|
|
FontSize="{TemplateBinding FontSize}"
|
|
FontWeight="{TemplateBinding FontWeight}"
|
|
Text="{DynamicResource STRING_DATEPICKER_DAY_TEXT}" />
|
|
<TextBlock
|
|
Name="PART_MonthTextBlock"
|
|
Padding="12,0"
|
|
VerticalAlignment="Center"
|
|
FontFamily="{TemplateBinding FontFamily}"
|
|
FontSize="{TemplateBinding FontSize}"
|
|
FontWeight="{TemplateBinding FontWeight}"
|
|
Text="{DynamicResource STRING_DATEPICKER_MONTH_TEXT}"
|
|
TextAlignment="Left" />
|
|
<TextBlock
|
|
Name="PART_YearTextBlock"
|
|
Padding="12,0"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
FontFamily="{TemplateBinding FontFamily}"
|
|
FontSize="{TemplateBinding FontSize}"
|
|
FontWeight="{TemplateBinding FontWeight}"
|
|
Text="{DynamicResource STRING_DATEPICKER_YEAR_TEXT}" />
|
|
<Rectangle
|
|
x:Name="PART_FirstSpacer"
|
|
Grid.Column="1"
|
|
Width="1"
|
|
Height="{TemplateBinding Height}"
|
|
MinHeight="{TemplateBinding MinHeight}"
|
|
HorizontalAlignment="Center"
|
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
|
<Rectangle
|
|
x:Name="PART_SecondSpacer"
|
|
Grid.Column="3"
|
|
Width="1"
|
|
Height="{TemplateBinding Height}"
|
|
MinHeight="{TemplateBinding MinHeight}"
|
|
HorizontalAlignment="Center"
|
|
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
|
|
</Grid>
|
|
<PathIcon
|
|
Name="PART_Icon"
|
|
Grid.Column="1"
|
|
Width="16"
|
|
Height="16"
|
|
Margin="0,0,8,0"
|
|
Data="{DynamicResource DatePickerIconGlyph}"
|
|
Foreground="{DynamicResource DateTimePickerIconForeground}" />
|
|
</Grid>
|
|
</Button>
|
|
<Popup
|
|
Name="PART_Popup"
|
|
Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
IsLightDismissEnabled="True"
|
|
Placement="Bottom"
|
|
PlacementTarget="{TemplateBinding}"
|
|
WindowManagerAddShadowHint="False">
|
|
<DatePickerPresenter Name="PART_PickerPresenter" />
|
|
</Popup>
|
|
<Button
|
|
Name="ClearButton"
|
|
Grid.Column="1"
|
|
Margin="0,0,8,0"
|
|
Command="{Binding $parent[DatePicker].Clear}"
|
|
Content="{DynamicResource IconButtonClearData}"
|
|
IsVisible="False"
|
|
Theme="{DynamicResource InnerIconButton}" />
|
|
</Grid>
|
|
</DataValidationErrors>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
|
|
<Style Selector="^.clearButton:pointerover, ^.ClearButton:pointerover">
|
|
<Style Selector="^:not(:hasnodate) /template/ Button#ClearButton">
|
|
<Setter Property="IsVisible" Value="True" />
|
|
</Style>
|
|
<Style Selector="^:not(:hasnodate) /template/ PathIcon#PART_Icon">
|
|
<Setter Property="Opacity" Value="0" />
|
|
</Style>
|
|
</Style>
|
|
|
|
<Style Selector="^:disabled /template/ PathIcon#PART_Icon">
|
|
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonDisabledIconForeground}" />
|
|
</Style>
|
|
|
|
<!-- Changes foreground for watermark text when SelectedDate is null -->
|
|
<Style Selector="^:hasnodate /template/ Button#PART_FlyoutButton TextBlock">
|
|
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerEmptyForeground}" />
|
|
</Style>
|
|
<Style Selector="^.Large">
|
|
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonLargeHeight}" />
|
|
</Style>
|
|
<Style Selector="^.Small">
|
|
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonSmallHeight}" />
|
|
</Style>
|
|
</ControlTheme>
|
|
|
|
</ResourceDictionary>
|