224 lines
13 KiB
XML
224 lines
13 KiB
XML
<!--
|
|
This Source Code Form is subject to the terms of the MIT License.
|
|
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
|
|
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
|
|
All Rights Reserved.
|
|
|
|
Based on Microsoft XAML for Win UI
|
|
Copyright (c) Microsoft Corporation. All Rights Reserved.
|
|
-->
|
|
|
|
<ResourceDictionary
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:WPFluent.Controls"
|
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
|
|
|
<Thickness x:Key="DatePickerBorderThemeThickness">1,1,1,0</Thickness>
|
|
<Thickness x:Key="DatePickerAccentBorderThemeThickness">0,0,0,1</Thickness>
|
|
<Thickness x:Key="DatePickerLeftIconMargin">10,8,0,0</Thickness>
|
|
<Thickness x:Key="DatePickerRightIconMargin">0,8,10,0</Thickness>
|
|
<Thickness x:Key="DatePickerCalendarButtonMargin">0,5,4,0</Thickness>
|
|
<Thickness x:Key="DatePickerCalendarButtonPadding">0,0,0,0</Thickness>
|
|
<system:Double x:Key="DatePickerCalendarButtonHeight">24</system:Double>
|
|
<system:Double x:Key="DatePickerCalendarButtonIconSize">14</system:Double>
|
|
|
|
<Style x:Key="DefaultDatePickerTextBoxStyle" TargetType="{x:Type DatePickerTextBox}">
|
|
<!-- Universal WPF UI focus -->
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
|
<!-- Universal WPF UI focus -->
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="Foreground">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorPrimary}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="CaretBrush">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorPrimary}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type DatePickerTextBox}">
|
|
<Border Margin="{TemplateBinding Margin}">
|
|
<Decorator x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" />
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="DefaultDatePickerStyle" TargetType="{x:Type DatePicker}">
|
|
<!-- Universal WPF UI focus -->
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
|
<!-- Universal WPF UI focus -->
|
|
<!-- Universal WPF UI ContextMenu -->
|
|
<Setter Property="ContextMenu" Value="{DynamicResource DefaultControlContextMenu}" />
|
|
<!-- Universal WPF UI ContextMenu -->
|
|
<!-- Default WPF UI Calendar style -->
|
|
<Setter Property="CalendarStyle" Value="{DynamicResource DefaultCalendarStyle}" />
|
|
<!-- Default WPF UI Calendar style -->
|
|
<Setter Property="Foreground">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource TextFillColorPrimary}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Background">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource ControlFillColorDefault}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
|
|
<Setter Property="BorderThickness" Value="{StaticResource DatePickerBorderThemeThickness}" />
|
|
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
|
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
<Setter Property="VerticalContentAlignment" Value="Top" />
|
|
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />
|
|
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
|
|
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
|
|
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type DatePicker}">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
<Grid
|
|
Grid.Row="0"
|
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
|
<Border
|
|
x:Name="ContentBorder"
|
|
MinWidth="{TemplateBinding MinWidth}"
|
|
MinHeight="{TemplateBinding MinHeight}"
|
|
Padding="0"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding Border.CornerRadius}">
|
|
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid Grid.Column="0">
|
|
<DatePickerTextBox
|
|
x:Name="PART_TextBox"
|
|
Margin="0"
|
|
Padding="{TemplateBinding Padding}"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
ContextMenu="{TemplateBinding ContextMenu}"
|
|
Focusable="{TemplateBinding Focusable}"
|
|
Foreground="{TemplateBinding Foreground}" />
|
|
</Grid>
|
|
<!-- Buttons and Icons have no padding from the main element to allow absolute positions if height is larger than the text entry zone -->
|
|
<controls:Button
|
|
x:Name="PART_Button"
|
|
Grid.Column="1"
|
|
Width="{StaticResource DatePickerCalendarButtonHeight}"
|
|
Height="{StaticResource DatePickerCalendarButtonHeight}"
|
|
Margin="{StaticResource DatePickerCalendarButtonMargin}"
|
|
Padding="{StaticResource DatePickerCalendarButtonPadding}"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Top"
|
|
HorizontalContentAlignment="Center"
|
|
VerticalContentAlignment="Center"
|
|
Appearance="Secondary"
|
|
Background="Transparent"
|
|
BorderBrush="Transparent"
|
|
Cursor="Arrow">
|
|
<!-- WPF overrides paddings for button -->
|
|
<controls:SymbolIcon
|
|
Margin="{StaticResource DatePickerCalendarButtonPadding}"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
FontSize="{StaticResource DatePickerCalendarButtonIconSize}"
|
|
Foreground="{TemplateBinding Foreground}"
|
|
Symbol="CalendarRtl24" />
|
|
</controls:Button>
|
|
</Grid>
|
|
</Border>
|
|
<!-- The Accent Border is a separate element so that changes to the border thickness do not affect the position of the element -->
|
|
<Border
|
|
x:Name="AccentBorder"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
BorderThickness="{StaticResource DatePickerAccentBorderThemeThickness}"
|
|
CornerRadius="{TemplateBinding Border.CornerRadius}">
|
|
<Border.BorderBrush>
|
|
<SolidColorBrush Color="{DynamicResource ControlStrongStrokeColorDefault}" />
|
|
</Border.BorderBrush>
|
|
</Border>
|
|
</Grid>
|
|
<Popup
|
|
x:Name="PART_Popup"
|
|
Grid.Row="1"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Top"
|
|
AllowsTransparency="True"
|
|
Placement="Mouse"
|
|
PlacementTarget="{Binding ElementName=PART_TextBox}"
|
|
StaysOpen="False" />
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsKeyboardFocusWithin" Value="True">
|
|
<Setter TargetName="AccentBorder" Property="BorderThickness" Value="0,0,0,2" />
|
|
<Setter TargetName="AccentBorder" Property="BorderBrush">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource SystemAccentColorSecondary}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter TargetName="ContentBorder" Property="Background">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource ControlFillColorInputActive}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsEnabled" Value="True" />
|
|
<Condition Property="IsMouseOver" Value="True" />
|
|
<Condition Property="IsKeyboardFocusWithin" Value="False" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter TargetName="ContentBorder" Property="Background">
|
|
<Setter.Value>
|
|
<SolidColorBrush Color="{DynamicResource ControlFillColorSecondary}" />
|
|
</Setter.Value>
|
|
</Setter>
|
|
</MultiTrigger>
|
|
<Trigger Property="IsEnabled" Value="True">
|
|
<Setter Property="Cursor" Value="IBeam" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource ControlFillColorDisabledBrush}" />
|
|
<Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
|
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style BasedOn="{StaticResource DefaultDatePickerTextBoxStyle}" TargetType="{x:Type DatePickerTextBox}" />
|
|
<Style BasedOn="{StaticResource DefaultDatePickerStyle}" TargetType="{x:Type DatePicker}" />
|
|
|
|
</ResourceDictionary>
|