Merge pull request #180 from irihitech/178-datavalidationerror

Add DataValidationError to Input Control
This commit is contained in:
Dong Bin 2023-05-08 23:26:08 +08:00 committed by GitHub
commit 37746e38f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 1127 additions and 613 deletions

View File

@ -0,0 +1,83 @@
<UserControl
x:Class="Semi.Avalonia.Demo.Pages.DataValidationErrorsDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:system="clr-namespace:System;assembly=netstandard"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<ScrollViewer>
<StackPanel HorizontalAlignment="Left" Spacing="20">
<AutoCompleteBox Width="300">
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</AutoCompleteBox>
<AutoCompleteBox Width="300" Classes="Large">
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</AutoCompleteBox>
<AutoCompleteBox Width="300" Classes="Small">
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</AutoCompleteBox>
<CalendarDatePicker Width="300">
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</CalendarDatePicker>
<ComboBox Width="300">
<ComboBoxItem>AAA</ComboBoxItem>
<ComboBoxItem>BBB</ComboBoxItem>
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</ComboBox>
<DatePicker Width="300">
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</DatePicker>
<NumericUpDown Width="300">
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</NumericUpDown>
<Slider Width="300">
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</Slider>
<TimePicker Width="300">
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</TimePicker>
<TextBox
Width="300"
InnerLeftContent="http://"
InnerRightContent=".com">
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</TextBox>
<TextBox
Width="300"
InnerLeftContent="http://"
InnerRightContent=".com">
<TextBox.Styles>
<Style Selector="TextBox /template/ DataValidationErrors">
<Setter Property="Theme" Value="{DynamicResource TooltipDataValidationErrors}" />
</Style>
</TextBox.Styles>
<DataValidationErrors.Error>
<system:Exception />
</DataValidationErrors.Error>
</TextBox>
</StackPanel>
</ScrollViewer>
</UserControl>

View File

@ -0,0 +1,18 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Semi.Avalonia.Demo.Pages;
public partial class DataValidationErrorsDemo : UserControl
{
public DataValidationErrorsDemo()
{
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}

View File

@ -4,6 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:system="clr-namespace:System;assembly=netstandard"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

View File

@ -105,6 +105,9 @@
<TabItem Header="ComboBox">
<pages:ComboBoxDemo />
</TabItem>
<TabItem Header="DataValidationErrors">
<pages:DataValidationErrorsDemo />
</TabItem>
<TabItem Header="DataGrid">
<pages:DataGridDemo />
</TabItem>

View File

@ -14,6 +14,13 @@
BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="TextBox">
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="20" />
<Style Selector="^ /template/ Border#PART_ContentPresenterBorder">
<Setter Property="MinHeight" Value="20" />
</Style>
<Style Selector="^:error:focus /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^ /template/ DataValidationErrors">
<Setter Property="Theme" Value="{DynamicResource TooltipDataValidationErrors}" />
</Style>

View File

@ -12,35 +12,38 @@
<Setter Property="AutoCompleteBox.MaxDropDownHeight" Value="{DynamicResource AutoCompleteMaxDropdownHeight}" />
<Setter Property="Template">
<ControlTemplate TargetType="AutoCompleteBox">
<Panel>
<TextBox
Name="PART_TextBox"
VerticalAlignment="Center"
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
Watermark="{TemplateBinding Watermark}" />
<Popup
Name="PART_Popup"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
IsLightDismissEnabled="True"
PlacementTarget="{TemplateBinding}">
<Border
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
HorizontalAlignment="Stretch"
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
<ListBox
Name="PART_SelectingItemsControl"
Foreground="{TemplateBinding Foreground}"
ItemTemplate="{TemplateBinding ItemTemplate}"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto" />
</Border>
</Popup>
</Panel>
<DataValidationErrors>
<Panel>
<TextBox
Name="PART_TextBox"
VerticalAlignment="Center"
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
Theme="{DynamicResource NonErrorTextBox}"
Watermark="{TemplateBinding Watermark}" />
<Popup
Name="PART_Popup"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
IsLightDismissEnabled="True"
PlacementTarget="{TemplateBinding}">
<Border
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
HorizontalAlignment="Stretch"
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
<ListBox
Name="PART_SelectingItemsControl"
Foreground="{TemplateBinding Foreground}"
ItemTemplate="{TemplateBinding ItemTemplate}"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto" />
</Border>
</Popup>
</Panel>
</DataValidationErrors>
</ControlTemplate>
</Setter>

View File

@ -34,107 +34,108 @@
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="CalendarDatePicker.MinHeight" Value="{DynamicResource CalendarDatePickerDefaultHeight}" />
<Setter Property="Padding" Value="8 0" />
<Setter Property="Template">
<ControlTemplate TargetType="CalendarDatePicker">
<Panel
x:Name="LayoutRoot"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Border
x:Name="Background"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
ColumnDefinitions="*,Auto">
<TextBox
Name="PART_TextBox"
Grid.Column="0"
MinHeight="{DynamicResource CalendarDatePickerInnerDefaultHeight}"
<DataValidationErrors>
<Panel
x:Name="LayoutRoot"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Border
x:Name="Background"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="0"
CornerRadius="{TemplateBinding CornerRadius}"
Foreground="{TemplateBinding Foreground}"
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
Watermark="{TemplateBinding Watermark}">
<TextBox.Styles>
<Style Selector="TextBox#PART_TextBox:pointerover /template/ Border#PART_ContentPresenterBorder">
<!-- By default the TextBox has its own focused state, override this to disable it here -->
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<Style Selector="TextBox#PART_TextBox:focus /template/ Border#PART_ContentPresenterBorder">
<!-- By default the TextBox has its own focused state, override this to disable it here -->
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<Style Selector="TextBox#PART_TextBox:disabled">
<Style Selector="^ /template/ Border#PART_ContentPresenterBorder">
<!-- By default the TextBox has its own disabled state, override this to make the border background show through -->
ColumnDefinitions="*,Auto">
<TextBox
Name="PART_TextBox"
Grid.Column="0"
MinHeight="{DynamicResource CalendarDatePickerDefaultHeight}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="0"
CornerRadius="{TemplateBinding CornerRadius}"
Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource NonErrorTextBox}"
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
Watermark="{TemplateBinding Watermark}">
<TextBox.Styles>
<Style Selector="TextBox#PART_TextBox:pointerover /template/ Border#PART_ContentPresenterBorder">
<!-- By default the TextBox has its own focused state, override this to disable it here -->
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
</Style>
</Style>
</TextBox.Styles>
</TextBox>
<Button
Name="PART_Button"
Grid.Column="1"
Padding="0,0,8,0"
Cursor="Hand"
Focusable="False"
Theme="{DynamicResource CalendarDatePickerButton}" />
<Popup
Name="PART_Popup"
HorizontalOffset="-8"
IsLightDismissEnabled="True"
PlacementTarget="{TemplateBinding}"
VerticalOffset="-4">
<Border
Margin="8"
Background="Transparent"
BoxShadow="{DynamicResource CalendarDatePickerPopupBoxShadows}"
CornerRadius="{DynamicResource CalendarCornerRadius}">
<Calendar
Name="PART_Calendar"
BorderThickness="0"
CornerRadius="{Binding $parent[Border].CornerRadius}"
DisplayDate="{TemplateBinding DisplayDate}"
DisplayDateEnd="{TemplateBinding DisplayDateEnd}"
DisplayDateStart="{TemplateBinding DisplayDateStart}"
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
SelectedDate="{TemplateBinding SelectedDate,
Mode=TwoWay}" />
</Border>
</Popup>
</Grid>
</Border>
<Style Selector="TextBox#PART_TextBox:focus /template/ Border#PART_ContentPresenterBorder">
<!-- By default the TextBox has its own focused state, override this to disable it here -->
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<Style Selector="TextBox#PART_TextBox:disabled">
<Style Selector="^ /template/ Border#PART_ContentPresenterBorder">
<!-- By default the TextBox has its own disabled state, override this to make the border background show through -->
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
</Style>
</TextBox.Styles>
</TextBox>
<Button
Name="PART_Button"
Grid.Column="1"
Padding="0,0,8,0"
Cursor="Hand"
Focusable="False"
Theme="{DynamicResource CalendarDatePickerButton}" />
<Popup
Name="PART_Popup"
HorizontalOffset="-8"
IsLightDismissEnabled="True"
PlacementTarget="{TemplateBinding}"
VerticalOffset="-4">
<Border
Margin="8"
Background="Transparent"
BoxShadow="{DynamicResource CalendarDatePickerPopupBoxShadows}"
CornerRadius="{DynamicResource CalendarCornerRadius}">
<Calendar
Name="PART_Calendar"
BorderThickness="0"
CornerRadius="{Binding $parent[Border].CornerRadius}"
DisplayDate="{TemplateBinding DisplayDate}"
DisplayDateEnd="{TemplateBinding DisplayDateEnd}"
DisplayDateStart="{TemplateBinding DisplayDateStart}"
FirstDayOfWeek="{TemplateBinding FirstDayOfWeek}"
IsTodayHighlighted="{TemplateBinding IsTodayHighlighted}"
SelectedDate="{TemplateBinding SelectedDate,
Mode=TwoWay}" />
</Border>
</Popup>
</Grid>
</Border>
</Panel>
</DataValidationErrors>
</Panel>
</ControlTemplate>
</Setter>
<Style Selector="^.Large">
<Setter Property="CalendarDatePicker.MinHeight" Value="{DynamicResource CalendarDatePickerLargeHeight}" />
<Style Selector="^ /template/ TextBox#PART_TextBox">
<Setter Property="TextBox.MinHeight" Value="{DynamicResource CalendarDatePickerInnerLargeHeight}" />
</Style>
</Style>
<Style Selector="^.Small">
<Setter Property="CalendarDatePicker.MinHeight" Value="{DynamicResource CalendarDatePickerSmallHeight}" />
<Style Selector="^ /template/ TextBox#PART_TextBox">
<Setter Property="TextBox.MinHeight" Value="{DynamicResource CalendarDatePickerInnerSmallHeight}" />
</Style>
@ -166,6 +167,25 @@
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerFocusBorderBrush}" />
</Style>
<Style Selector="^:error">
<Style Selector="^ /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:pointerover /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:pressed /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:focus-within /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Bordered">
<Style Selector="^ Border#Background">
<Setter Property="Border.Background" Value="{DynamicResource CalendarDatePickerBorderedDefaultBackground}" />
@ -189,6 +209,24 @@
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerDisabledIconForeground}" />
</Style>
</Style>
<Style Selector="^:error">
<Style Selector="^ /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ Border#Background">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsPointerOverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ Border#Background">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsPressedBorderBrush}" />
</Style>
<Style Selector="^:focus-within /template/ Border#Background">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@ -36,7 +36,6 @@
<Setter Property="CornerRadius" Value="{DynamicResource ComboBoxSelectorCornerRadius}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="MinHeight" Value="{DynamicResource ComboBoxDefaultHeight}" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Left" />
@ -45,96 +44,99 @@
<Setter Property="PlaceholderForeground" Value="{DynamicResource ComboBoxPlaceHolderForeground}" />
<Setter Property="Template">
<ControlTemplate TargetType="ComboBox">
<Grid ColumnDefinitions="*,32">
<Border
x:Name="Background"
Grid.Column="0"
Grid.ColumnSpan="2"
MinWidth="{DynamicResource ComboBoxThemeMinWidth}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock
x:Name="PlaceholderTextBlock"
Grid.Column="0"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Foreground="{TemplateBinding Foreground}"
IsVisible="{TemplateBinding SelectionBoxItem,
Converter={x:Static ObjectConverters.IsNull}}"
Opacity="0.3"
Text="{TemplateBinding PlaceholderText}" />
<ContentPresenter
x:Name="ContentPresenter"
Grid.Column="0"
Margin="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding ItemTemplate}" />
<Border
x:Name="DropDownOverlay"
Grid.Column="1"
Width="30"
Margin="0,1,1,1"
HorizontalAlignment="Right"
Background="Transparent"
IsVisible="False" />
<PathIcon
x:Name="DropDownGlyph"
Grid.Column="1"
Width="12"
Height="12"
Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Data="{DynamicResource ComboBoxIcon}"
Foreground="{DynamicResource ComboBoxIconDefaultForeground}"
IsHitTestVisible="False"
UseLayoutRounding="False" />
<Popup
Name="PART_Popup"
Grid.Column="0"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
ClipToBounds="False"
InheritsTransform="True"
IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsDropDownOpen,
Mode=TwoWay}"
PlacementTarget="Background"
WindowManagerAddShadowHint="False">
<DataValidationErrors>
<Grid ColumnDefinitions="*,32">
<Border
x:Name="PopupBorder"
Margin="0,4"
HorizontalAlignment="Stretch"
Background="{DynamicResource ComboBoxPopupBackground}"
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
ClipToBounds="True"
CornerRadius="6">
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter
Name="PART_ItemsPresenter"
Margin="{DynamicResource ComboBoxDropdownContentMargin}"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</ScrollViewer>
</Border>
</Popup>
</Grid>
x:Name="Background"
Grid.Column="0"
Grid.ColumnSpan="2"
MinHeight="{DynamicResource ComboBoxDefaultHeight}"
MinWidth="{DynamicResource ComboBoxThemeMinWidth}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}" />
<TextBlock
x:Name="PlaceholderTextBlock"
Grid.Column="0"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Foreground="{TemplateBinding Foreground}"
IsVisible="{TemplateBinding SelectionBoxItem,Converter={x:Static ObjectConverters.IsNull}}"
Opacity="0.3"
Text="{TemplateBinding PlaceholderText}" />
<ContentPresenter
x:Name="ContentPresenter"
Grid.Column="0"
Margin="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding ItemTemplate}" />
<Border
x:Name="DropDownOverlay"
Grid.Column="1"
Width="30"
Margin="0,1,1,1"
HorizontalAlignment="Right"
Background="Transparent"
IsVisible="False" />
<PathIcon
x:Name="DropDownGlyph"
Grid.Column="1"
Width="12"
Height="12"
Margin="0,0,10,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Data="{DynamicResource ComboBoxIcon}"
Foreground="{DynamicResource ComboBoxIconDefaultForeground}"
IsHitTestVisible="False"
UseLayoutRounding="False" />
<Popup
Name="PART_Popup"
Grid.Column="0"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
ClipToBounds="False"
InheritsTransform="True"
IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsDropDownOpen,Mode=TwoWay}"
PlacementTarget="Background"
WindowManagerAddShadowHint="False">
<Border
x:Name="PopupBorder"
Margin="0,4"
HorizontalAlignment="Stretch"
Background="{DynamicResource ComboBoxPopupBackground}"
BorderBrush="{DynamicResource ComboBoxPopupBorderBrush}"
BorderThickness="{DynamicResource ComboBoxPopupBorderThickness}"
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
ClipToBounds="True"
CornerRadius="6">
<ScrollViewer
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter
Name="PART_ItemsPresenter"
Margin="{DynamicResource ComboBoxDropdownContentMargin}"
ItemsPanel="{TemplateBinding ItemsPanel}" />
</ScrollViewer>
</Border>
</Popup>
</Grid>
</DataValidationErrors>
</ControlTemplate>
</Setter>
<Style Selector="^.Large">
<Style Selector="^.Large /template/ Border#Background">
<Setter Property="ComboBox.MinHeight" Value="{DynamicResource ComboBoxLargeHeight}" />
</Style>
<Style Selector="^.Small">
<Style Selector="^.Small /template/ Border#Background">
<Setter Property="ComboBox.MinHeight" Value="{DynamicResource ComboBoxSmallHeight}" />
</Style>
@ -173,6 +175,25 @@
<Setter Property="Foreground" Value="{DynamicResource ComboBoxIconDisabledForeground}" />
</Style>
</Style>
<!-- Error State -->
<Style Selector="^:error">
<Style Selector="^ /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
</Style>
<Style Selector="^:pointerover /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:pressed /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:focus /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.Bordered">
<Style Selector="^ /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource ComboBoxSelectorBorderedBackground}" />
@ -201,6 +222,24 @@
<Setter Property="Foreground" Value="{DynamicResource ComboBoxIconDisabledForeground}" />
</Style>
</Style>
<Style Selector="^:error">
<Style Selector="^ /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsPointerOverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsPressedBorderBrush}" />
</Style>
<Style Selector="^:focus /template/ Border#Background">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
</Style>
</ControlTheme>

View File

@ -16,6 +16,7 @@
<ResourceInclude Source="avares://Semi.Avalonia/Controls/ComboBox.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Controls/ContentControl.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Controls/ContextMenu.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Controls/DataValidationErrors.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Controls/DatePicker.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Controls/DateTimePickerShared.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Controls/DropDownButton.axaml" />

View File

@ -0,0 +1,108 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:collections="clr-namespace:System.Collections;assembly=netstandard">
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type DataValidationErrors}" TargetType="DataValidationErrors">
<Setter Property="Template">
<ControlTemplate TargetType="DataValidationErrors">
<DockPanel LastChildFill="True">
<ContentControl
x:Name="InlineDataValidationContentControl"
Margin="0,4,0,0"
Content="{Binding (DataValidationErrors.Errors)}"
ContentTemplate="{TemplateBinding ErrorTemplate}"
DataContext="{TemplateBinding Owner}"
DockPanel.Dock="Bottom"
IsVisible="{Binding (DataValidationErrors.HasErrors)}" />
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" />
</DockPanel>
</ControlTemplate>
</Setter>
<Setter Property="ErrorTemplate">
<DataTemplate>
<ItemsControl
x:DataType="DataValidationErrors"
Foreground="{DynamicResource DataValidationErrorsForeground}"
ItemsSource="{Binding}">
<ItemsControl.Styles>
<Style Selector="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</ItemsControl.Styles>
</ItemsControl>
</DataTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="SilentDataValidationErrors" TargetType="DataValidationErrors">
<Setter Property="Template">
<ControlTemplate TargetType="DataValidationErrors">
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="TooltipDataValidationErrors" TargetType="DataValidationErrors">
<Setter Property="Template">
<ControlTemplate TargetType="DataValidationErrors">
<DockPanel LastChildFill="True">
<ContentControl
Content="{Binding (DataValidationErrors.Errors)}"
ContentTemplate="{TemplateBinding ErrorTemplate}"
DataContext="{TemplateBinding Owner}"
DockPanel.Dock="Right"
IsVisible="{Binding (DataValidationErrors.HasErrors)}" />
<ContentPresenter
Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}" />
</DockPanel>
</ControlTemplate>
</Setter>
<Setter Property="ErrorTemplate">
<DataTemplate>
<Panel Name="PART_InlineErrorTemplatePanel" Background="Transparent">
<Panel.Styles>
<Style Selector="Panel#PART_InlineErrorTemplatePanel">
<Setter Property="Margin" Value="8,0" />
</Style>
<Style Selector="Panel#PART_InlineErrorTemplatePanel ToolTip">
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsForeground}" />
</Style>
<Style Selector="Panel#PART_InlineErrorTemplatePanel ToolTip TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</Panel.Styles>
<ToolTip.Tip>
<ItemsControl x:DataType="collections:IEnumerable" ItemsSource="{Binding}" />
</ToolTip.Tip>
<Path
Width="14"
Height="14"
Data="M14,7 A7,7 0 0,0 0,7 M0,7 A7,7 0 1,0 14,7 M7,3l0,5 M7,9l0,2"
Stroke="{DynamicResource DataValidationErrorsForeground}"
StrokeThickness="2" />
</Panel>
</DataTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>

View File

@ -125,7 +125,6 @@
</ControlTheme>
<ControlTheme x:Key="{x:Type DatePicker}" TargetType="DatePicker">
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonDefaultHeight}" />
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonForeground}" />
<Setter Property="Background" Value="{DynamicResource DateTimePickerButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonBorderBrush}" />
@ -135,90 +134,94 @@
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Template">
<ControlTemplate TargetType="DatePicker">
<Grid Name="LayoutRoot" Margin="{TemplateBinding Padding}">
<Button
Name="PART_FlyoutButton"
Width="298"
MinWidth="298"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Cursor="Hand"
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,4"
HorizontalAlignment="Center"
<DataValidationErrors>
<Grid Name="LayoutRoot" Margin="{TemplateBinding Padding}">
<Button
Name="PART_FlyoutButton"
Width="298"
MinWidth="298"
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}"
MinHeight="{DynamicResource DateTimePickerButtonDefaultHeight}"
Theme="{StaticResource DateTimePickerFlyoutButton}">
<Grid ColumnDefinitions="*, Auto">
<Grid
Name="PART_ButtonContentGrid"
Grid.Column="0"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Text="day" />
<TextBlock
Name="PART_MonthTextBlock"
Padding="12,4"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Text="month"
TextAlignment="Left" />
<TextBlock
Name="PART_YearTextBlock"
Padding="12,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Text="year" />
<Rectangle
x:Name="PART_FirstSpacer"
ColumnDefinitions="78*,Auto,132*,Auto,78*">
<TextBlock
Name="PART_DayTextBlock"
Padding="12,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Text="day" />
<TextBlock
Name="PART_MonthTextBlock"
Padding="12,4"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Text="month"
TextAlignment="Left" />
<TextBlock
Name="PART_YearTextBlock"
Padding="12,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Text="year" />
<Rectangle
x:Name="PART_FirstSpacer"
Grid.Column="1"
Width="1"
Margin="0,4"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
<Rectangle
x:Name="PART_SecondSpacer"
Grid.Column="3"
Width="1"
Margin="0,4"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
</Grid>
<PathIcon
Name="PART_Icon"
Grid.Column="1"
Width="1"
Margin="0,4"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
<Rectangle
x:Name="PART_SecondSpacer"
Grid.Column="3"
Width="1"
Margin="0,4"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
Width="16"
Height="16"
Margin="0,0,8,0"
Data="{DynamicResource DatePickerIconGlyph}"
Foreground="{DynamicResource DateTimePickerIconForeground}" />
</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>
</Button>
<Popup
Name="PART_Popup"
IsLightDismissEnabled="True"
Placement="Bottom"
PlacementTarget="{TemplateBinding}"
WindowManagerAddShadowHint="False">
<DatePickerPresenter Name="PART_PickerPresenter" />
</Popup>
<Popup
Name="PART_Popup"
IsLightDismissEnabled="True"
Placement="Bottom"
PlacementTarget="{TemplateBinding}"
WindowManagerAddShadowHint="False">
<DatePickerPresenter Name="PART_PickerPresenter" />
</Popup>
</Grid>
</Grid>
</DataValidationErrors>
</ControlTemplate>
</Setter>
@ -230,10 +233,10 @@
<Style Selector="^:hasnodate /template/ Button#PART_FlyoutButton TextBlock">
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerEmptyForeground}" />
</Style>
<Style Selector="^.Large">
<Style Selector="^.Large /template/ Button#PART_FlyoutButton">
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonLargeHeight}" />
</Style>
<Style Selector="^.Small">
<Style Selector="^.Small /template/ Button#PART_FlyoutButton">
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonSmallHeight}" />
</Style>
</ControlTheme>

View File

@ -30,6 +30,25 @@
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonDisabledBorderBrush}" />
<Setter Property="Background" Value="{DynamicResource DateTimePickerButtonDisabledBackground}" />
</Style>
<Style Selector="^:error">
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:focus /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
</ControlTheme>
<!-- Theme for the items displayed in the selectors -->

View File

@ -5,45 +5,67 @@
<!-- Add Resources Here -->
<ControlTheme x:Key="{x:Type NumericUpDown}" TargetType="NumericUpDown">
<Setter Property="NumericUpDown.VerticalContentAlignment" Value="Center" />
<Setter Property="NumericUpDown.MinHeight" Value="{DynamicResource NumericUpDownWrapperDefaultHeight}" />
<Setter Property="NumericUpDown.CornerRadius" Value="{DynamicResource NumericUpDownCornerRadius}" />
<Setter Property="NumericUpDown.Template">
<ControlTemplate TargetType="NumericUpDown">
<ButtonSpinner
Name="PART_Spinner"
MinWidth="0"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AllowSpin="{TemplateBinding AllowSpin}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
<TextBox
Name="PART_TextBox"
Height="{TemplateBinding Height}"
MinHeight="{TemplateBinding MinHeight}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
AcceptsReturn="False"
CornerRadius="{TemplateBinding CornerRadius}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}"
IsReadOnly="{TemplateBinding IsReadOnly}"
Text="{TemplateBinding Text}"
TextWrapping="NoWrap"
Watermark="{TemplateBinding Watermark}" />
</ButtonSpinner>
<DataValidationErrors>
<ButtonSpinner
Name="PART_Spinner"
MinWidth="0"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
AllowSpin="{TemplateBinding AllowSpin}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ButtonSpinnerLocation="{TemplateBinding ButtonSpinnerLocation}"
ShowButtonSpinner="{TemplateBinding ShowButtonSpinner}">
<TextBox
Name="PART_TextBox"
Height="{TemplateBinding Height}"
MinHeight="{DynamicResource NumericUpDownWrapperDefaultHeight}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
AcceptsReturn="False"
CornerRadius="{TemplateBinding CornerRadius}"
DataValidationErrors.Errors="{ReflectionBinding $parent[NumericUpDown].(DataValidationErrors.Errors)}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}"
IsReadOnly="{TemplateBinding IsReadOnly}"
Text="{TemplateBinding Text}"
TextWrapping="NoWrap"
Theme="{DynamicResource NonErrorTextBox}"
Watermark="{TemplateBinding Watermark}" />
</ButtonSpinner>
</DataValidationErrors>
</ControlTemplate>
</Setter>
<Style Selector="^.Large">
<Style Selector="^.Large /template/ TextBox#PART_TextBox">
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownWrapperLargeHeight}" />
</Style>
<Style Selector="^.Small">
<Style Selector="^.Small /template/ TextBox#PART_TextBox">
<Setter Property="MinHeight" Value="{DynamicResource NumericUpDownWrapperSmallHeight}" />
</Style>
<Style Selector="^:error">
<Style Selector="^ /template/ TextBox#PART_TextBox">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:pointerover /template/ TextBox#PART_TextBox">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:pressed /template/ TextBox#PART_TextBox">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:focus /template/ TextBox#PART_TextBox">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
</ControlTheme>
</ResourceDictionary>
</ResourceDictionary>

View File

@ -60,10 +60,10 @@
CornerRadius="{TemplateBinding CornerRadius}" />
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ Border">
<Style Selector="^:pointerover">
<Setter Property="BorderBrush" Value="{DynamicResource SliderThumbPointeroverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ Border">
<Style Selector="^:pressed">
<Setter Property="BorderBrush" Value="{DynamicResource SliderThumbPressedBorderBrush}" />
</Style>
</ControlTheme>
@ -75,165 +75,155 @@
<Style Selector="^:horizontal">
<Setter Property="Template">
<ControlTemplate TargetType="Slider">
<Border
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<DataValidationErrors>
<Grid
x:Name="SliderContainer"
Margin="{TemplateBinding Padding}"
Background="Transparent">
Background="Transparent"
RowDefinitions="Auto,Auto,Auto">
<Grid.Styles>
<Style Selector="TickBar">
<Setter Property="ReservedSpace" Value="{Binding #PART_Track.Thumb.Bounds}" />
</Style>
</Grid.Styles>
<Grid x:Name="HorizontalTemplate" RowDefinitions="Auto,Auto,Auto">
<TickBar
Name="TopTickBar"
Grid.Row="0"
Height="{DynamicResource SliderTickHorizontalHeight}"
Margin="0,0,0,4"
VerticalAlignment="Bottom"
Fill="{DynamicResource SliderTickForeground}"
IsVisible="False"
Maximum="{TemplateBinding Slider.Maximum}"
Minimum="{TemplateBinding Slider.Minimum}"
Orientation="{TemplateBinding Slider.Orientation}"
Placement="Top"
TickFrequency="{TemplateBinding Slider.TickFrequency}"
Ticks="{TemplateBinding Ticks}" />
<TickBar
Name="BottomTickBar"
Grid.Row="2"
Height="{DynamicResource SliderTickHorizontalHeight}"
Margin="0,4,0,0"
VerticalAlignment="Top"
Fill="{DynamicResource SliderTickForeground}"
IsVisible="False"
Maximum="{TemplateBinding Slider.Maximum}"
Minimum="{TemplateBinding Slider.Minimum}"
Orientation="{TemplateBinding Slider.Orientation}"
Placement="Bottom"
TickFrequency="{TemplateBinding Slider.TickFrequency}"
Ticks="{TemplateBinding Ticks}" />
<Track
Name="PART_Track"
Grid.Row="1"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Orientation="Horizontal"
Value="{TemplateBinding Value,
Mode=TwoWay}">
<Track.DecreaseButton>
<RepeatButton
Name="PART_DecreaseButton"
Background="{TemplateBinding Foreground}"
Focusable="False"
Theme="{StaticResource SliderHorizontalRepeatButton}" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton
Name="PART_IncreaseButton"
Background="{TemplateBinding Background}"
Focusable="False"
Theme="{StaticResource SliderHorizontalRepeatButton}" />
</Track.IncreaseButton>
<Thumb
Name="thumb"
Width="{DynamicResource SliderThumbWidth}"
Height="{DynamicResource SliderThumbHeight}"
DataContext="{TemplateBinding Value}"
Theme="{StaticResource SliderThumbTheme}" />
</Track>
</Grid>
<TickBar
Name="TopTickBar"
Grid.Row="0"
Height="{DynamicResource SliderTickHorizontalHeight}"
Margin="0,0,0,4"
VerticalAlignment="Bottom"
Fill="{DynamicResource SliderTickForeground}"
IsVisible="False"
Maximum="{TemplateBinding Slider.Maximum}"
Minimum="{TemplateBinding Slider.Minimum}"
Orientation="{TemplateBinding Slider.Orientation}"
Placement="Top"
TickFrequency="{TemplateBinding Slider.TickFrequency}"
Ticks="{TemplateBinding Ticks}" />
<TickBar
Name="BottomTickBar"
Grid.Row="2"
Height="{DynamicResource SliderTickHorizontalHeight}"
Margin="0,4,0,0"
VerticalAlignment="Top"
Fill="{DynamicResource SliderTickForeground}"
IsVisible="False"
Maximum="{TemplateBinding Slider.Maximum}"
Minimum="{TemplateBinding Slider.Minimum}"
Orientation="{TemplateBinding Slider.Orientation}"
Placement="Bottom"
TickFrequency="{TemplateBinding Slider.TickFrequency}"
Ticks="{TemplateBinding Ticks}" />
<Track
Name="PART_Track"
Grid.Row="1"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Orientation="Horizontal"
Value="{TemplateBinding Value,
Mode=TwoWay}">
<Track.DecreaseButton>
<RepeatButton
Name="PART_DecreaseButton"
Background="{TemplateBinding Foreground}"
Focusable="False"
Theme="{StaticResource SliderHorizontalRepeatButton}" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton
Name="PART_IncreaseButton"
Background="{TemplateBinding Background}"
Focusable="False"
Theme="{StaticResource SliderHorizontalRepeatButton}" />
</Track.IncreaseButton>
<Thumb
Name="thumb"
Width="{DynamicResource SliderThumbWidth}"
Height="{DynamicResource SliderThumbHeight}"
DataContext="{TemplateBinding Value}"
Theme="{StaticResource SliderThumbTheme}" />
</Track>
</Grid>
</Border>
</DataValidationErrors>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="^:vertical">
<Setter Property="Template">
<ControlTemplate>
<Border
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<DataValidationErrors>
<Grid
x:Name="SliderContainer"
MinWidth="{DynamicResource SliderVerticalWidth}"
Margin="{TemplateBinding Padding}"
Background="{DynamicResource SliderContainerBackground}">
Background="{DynamicResource SliderContainerBackground}"
ColumnDefinitions="Auto,Auto,Auto">
<Grid.Styles>
<Style Selector="TickBar">
<Setter Property="ReservedSpace" Value="{Binding #PART_Track.Thumb.Bounds}" />
</Style>
</Grid.Styles>
<Grid
x:Name="VerticalTemplate"
MinWidth="{DynamicResource SliderVerticalWidth}"
ColumnDefinitions="Auto,Auto,Auto">
<TickBar
Name="LeftTickBar"
Grid.Column="0"
Width="{DynamicResource SliderTickVerticalWidth}"
Margin="0,0,4,0"
HorizontalAlignment="Right"
Fill="{DynamicResource SliderTickForeground}"
IsVisible="False"
Maximum="{TemplateBinding Slider.Maximum}"
Minimum="{TemplateBinding Slider.Minimum}"
Orientation="{TemplateBinding Slider.Orientation}"
Placement="Left"
TickFrequency="{TemplateBinding Slider.TickFrequency}"
Ticks="{TemplateBinding Ticks}" />
<TickBar
Name="RightTickBar"
Grid.Column="2"
Width="{DynamicResource SliderTickVerticalWidth}"
Margin="4,0,0,0"
HorizontalAlignment="Left"
Fill="{DynamicResource SliderTickForeground}"
IsVisible="False"
Maximum="{TemplateBinding Slider.Maximum}"
Minimum="{TemplateBinding Slider.Minimum}"
Orientation="{TemplateBinding Slider.Orientation}"
Placement="Right"
TickFrequency="{TemplateBinding Slider.TickFrequency}"
Ticks="{TemplateBinding Ticks}" />
<Track
Name="PART_Track"
Grid.Column="1"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Orientation="Vertical"
Value="{TemplateBinding Value,
Mode=TwoWay}">
<Track.DecreaseButton>
<RepeatButton
Name="PART_DecreaseButton"
Background="{TemplateBinding Foreground}"
Focusable="False"
Theme="{StaticResource SliderVerticalRepeatButton}" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton
Name="PART_IncreaseButton"
Background="{TemplateBinding Background}"
Focusable="False"
Theme="{StaticResource SliderVerticalRepeatButton}" />
</Track.IncreaseButton>
<Thumb
Name="thumb"
Width="{DynamicResource SliderThumbWidth}"
Height="{DynamicResource SliderThumbHeight}"
DataContext="{TemplateBinding Value}"
Theme="{StaticResource SliderThumbTheme}" />
</Track>
</Grid>
<TickBar
Name="LeftTickBar"
Grid.Column="0"
Width="{DynamicResource SliderTickVerticalWidth}"
Margin="0,0,4,0"
HorizontalAlignment="Right"
Fill="{DynamicResource SliderTickForeground}"
IsVisible="False"
Maximum="{TemplateBinding Slider.Maximum}"
Minimum="{TemplateBinding Slider.Minimum}"
Orientation="{TemplateBinding Slider.Orientation}"
Placement="Left"
TickFrequency="{TemplateBinding Slider.TickFrequency}"
Ticks="{TemplateBinding Ticks}" />
<TickBar
Name="RightTickBar"
Grid.Column="2"
Width="{DynamicResource SliderTickVerticalWidth}"
Margin="4,0,0,0"
HorizontalAlignment="Left"
Fill="{DynamicResource SliderTickForeground}"
IsVisible="False"
Maximum="{TemplateBinding Slider.Maximum}"
Minimum="{TemplateBinding Slider.Minimum}"
Orientation="{TemplateBinding Slider.Orientation}"
Placement="Right"
TickFrequency="{TemplateBinding Slider.TickFrequency}"
Ticks="{TemplateBinding Ticks}" />
<Track
Name="PART_Track"
Grid.Column="1"
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
Maximum="{TemplateBinding Maximum}"
Minimum="{TemplateBinding Minimum}"
Orientation="Vertical"
Value="{TemplateBinding Value,
Mode=TwoWay}">
<Track.DecreaseButton>
<RepeatButton
Name="PART_DecreaseButton"
Background="{TemplateBinding Foreground}"
Focusable="False"
Theme="{StaticResource SliderVerticalRepeatButton}" />
</Track.DecreaseButton>
<Track.IncreaseButton>
<RepeatButton
Name="PART_IncreaseButton"
Background="{TemplateBinding Background}"
Focusable="False"
Theme="{StaticResource SliderVerticalRepeatButton}" />
</Track.IncreaseButton>
<Thumb
Name="thumb"
Width="{DynamicResource SliderThumbWidth}"
Height="{DynamicResource SliderThumbHeight}"
DataContext="{TemplateBinding Value}"
Theme="{StaticResource SliderThumbTheme}" />
</Track>
</Grid>
</Border>
</DataValidationErrors>
</ControlTemplate>
</Setter>
</Style>
@ -263,6 +253,10 @@
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:error /template/ Thumb#thumb">
<Setter Property="Thumb.BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
<!-- Disabled State -->
<Style Selector="^:disabled">

View File

@ -96,7 +96,6 @@
<Setter Property="TextBox.FontSize" Value="14" />
<Setter Property="TextBox.Cursor" Value="Ibeam" />
<Setter Property="TextBox.CaretBrush" Value="{DynamicResource TextBoxTextCaretBrush}" />
<Setter Property="TextBox.MinHeight" Value="{DynamicResource TextBoxWrapperDefaultHeight}" />
<Setter Property="TextBox.Padding" Value="{DynamicResource TextBoxContentPadding}" />
<Setter Property="TextBox.VerticalContentAlignment" Value="Center" />
<Setter Property="TextBox.FocusAdorner" Value="{x:Null}" />
@ -104,22 +103,207 @@
<Setter Property="TextBox.ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" />
<Setter Property="TextBox.Template">
<ControlTemplate TargetType="TextBox">
<Border
Name="PART_ContentPresenterBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid Margin="{TemplateBinding Padding}" ColumnDefinitions="Auto,*,Auto, Auto, Auto">
<ContentPresenter
Grid.Column="0"
Padding="{DynamicResource TextBoxInnerLeftContentPadding}"
VerticalAlignment="Center"
Content="{TemplateBinding InnerLeftContent}"
Foreground="{DynamicResource TextBoxInnerForeground}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerLeftContent, Converter={x:Static ObjectConverters.IsNotNull}}" />
<DataValidationErrors>
<Border
Name="PART_ContentPresenterBorder"
MinHeight="{DynamicResource TextBoxWrapperDefaultHeight}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Grid Margin="{TemplateBinding Padding}" ColumnDefinitions="Auto,*,Auto, Auto, Auto">
<ContentPresenter
Grid.Column="0"
Padding="{DynamicResource TextBoxInnerLeftContentPadding}"
VerticalAlignment="Center"
Content="{TemplateBinding InnerLeftContent}"
Foreground="{DynamicResource TextBoxInnerForeground}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerLeftContent, Converter={x:Static ObjectConverters.IsNotNull}}" />
<ScrollViewer
Grid.Column="1"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
<Panel>
<TextBlock
Name="PART_Watermark"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
IsVisible="{TemplateBinding Text,
Converter={x:Static StringConverters.IsNullOrEmpty}}"
Opacity="0.5"
Text="{TemplateBinding Watermark}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}" />
<TextPresenter
Name="PART_TextPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
CaretBrush="{TemplateBinding CaretBrush}"
CaretIndex="{TemplateBinding CaretIndex}"
LineHeight="{TemplateBinding LineHeight}"
PasswordChar="{TemplateBinding PasswordChar}"
RevealPassword="{TemplateBinding RevealPassword}"
SelectionBrush="{TemplateBinding SelectionBrush}"
SelectionEnd="{TemplateBinding SelectionEnd}"
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
SelectionStart="{TemplateBinding SelectionStart}"
Text="{TemplateBinding Text,
Mode=TwoWay}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}" />
</Panel>
</ScrollViewer>
<Button
Name="PART_ClearButton"
Grid.Column="2"
Command="{Binding $parent[TextBox].Clear}"
IsVisible="False"
Theme="{StaticResource InputClearButton}" />
<ToggleButton
Name="PART_RevealButton"
Grid.Column="3"
Margin="4,0,0,0"
IsChecked="{TemplateBinding RevealPassword,
Mode=TwoWay}"
IsVisible="False"
Theme="{StaticResource InputToggleButton}" />
<ContentPresenter
Grid.Column="4"
Padding="{DynamicResource TextBoxInnerRightContentPadding}"
VerticalAlignment="Center"
Content="{TemplateBinding InnerRightContent}"
Foreground="{DynamicResource TextBoxInnerForeground}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerRightContent, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Grid>
</Border>
</DataValidationErrors>
</ControlTemplate>
</Setter>
<Style Selector="^:pointerover /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource TextBoxPointeroverBackground}" />
</Style>
<Style Selector="^:pressed /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource TextBoxPressedBackground}" />
</Style>
<Style Selector="^:focus /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.BorderBrush" Value="{DynamicResource TextBoxFocusBorderBrush}" />
</Style>
<Style Selector="^:disabled /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.BorderBrush" Value="{DynamicResource TextBoxDisabledBorderBrush}" />
<Setter Property="Border.Background" Value="{DynamicResource TextBoxDisabledBackground}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="TextBox.Foreground" Value="{DynamicResource TextBoxDisabledForeground}" />
</Style>
<Style Selector="^:error">
<Style Selector="^ /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:pointerover /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
<Setter Property="Border.BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:pressed /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
<Setter Property="Border.BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:focus /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
<Style Selector="^.clearButton, ^.ClearButton">
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:focus:not(:empty) /template/ Button#PART_ClearButton">
<Setter Property="Button.IsVisible" Value="True" />
</Style>
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:pointerover:not(:empty) /template/ Button#PART_ClearButton">
<Setter Property="Button.IsVisible" Value="True" />
</Style>
</Style>
<Style Selector="^.revealPasswordButton, ^.RevealPasswordButton">
<Style Selector="^ /template/ ToggleButton#PART_RevealButton">
<Setter Property="ToggleButton.IsVisible" Value="True" />
</Style>
</Style>
<Style Selector="^.Large /template/ Border#PART_ContentPresenterBorder">
<Setter Property="MinHeight" Value="{DynamicResource TextBoxWrapperLargeHeight}" />
</Style>
<Style Selector="^.Small /template/ Border#PART_ContentPresenterBorder">
<Setter Property="MinHeight" Value="{DynamicResource TextBoxWrapperSmallHeight}" />
</Style>
<Style Selector="^.Bordered">
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxBorderedDefaultBackground}" />
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxBorderedDefaultBorderBrush}" />
<Style Selector="^:pointerover /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource TextBoxBorderedPointeroverBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource TextBoxBorderedPointeroverBorderBrush}" />
</Style>
<Style Selector="^:focus">
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxBorderedPointeroverBackground}" />
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxBorderedPointeroverBorderBrush}" />
</Style>
<Style Selector="^:disabled /template/ Border#PART_ContentPresenterBorder">
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxDisabledBackground}" />
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDisabledBorderBrush}" />
</Style>
<Style Selector="^:error">
<Style Selector="^ /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DataValidationErrorsBorderBrush}" />
</Style>
<Style Selector="^:pointerover /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsPointerOverBorderBrush}" />
</Style>
<Style Selector="^:pressed /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsPressedBorderBrush}" />
</Style>
<Style Selector="^:focus /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
</Style>
</ControlTheme>
<ControlTheme x:Key="NonErrorTextBox" TargetType="TextBox">
<Setter Property="TextBox.Foreground" Value="{DynamicResource TextBoxForeground}" />
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxDefaultBackground}" />
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDefaultBorderBrush}" />
<Setter Property="TextBox.SelectionBrush" Value="{DynamicResource TextBoxSelectionBackground}" />
<Setter Property="TextBox.SelectionForegroundBrush" Value="{DynamicResource TextBoxSelectionForeground}" />
<Setter Property="TextBox.BorderThickness" Value="{DynamicResource TextBoxBorderThickness}" />
<Setter Property="TextBox.CornerRadius" Value="{DynamicResource TextBoxDefaultCornerRadius}" />
<Setter Property="TextBox.FontSize" Value="14" />
<Setter Property="TextBox.Cursor" Value="Ibeam" />
<Setter Property="TextBox.CaretBrush" Value="{DynamicResource TextBoxTextCaretBrush}" />
<Setter Property="TextBox.Padding" Value="{DynamicResource TextBoxContentPadding}" />
<Setter Property="TextBox.MinHeight" Value="{DynamicResource TextBoxWrapperDefaultHeight}" />
<Setter Property="TextBox.VerticalContentAlignment" Value="Center" />
<Setter Property="TextBox.FocusAdorner" Value="{x:Null}" />
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="True" />
<Setter Property="TextBox.ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" />
<Setter Property="TextBox.Template">
<ControlTemplate TargetType="TextBox">
<DataValidationErrors Theme="{DynamicResource SilentDataValidationErrors}">
<Border
Name="PART_ContentPresenterBorder"
MinHeight="{TemplateBinding MinHeight}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<ScrollViewer
Grid.Column="1"
Margin="{TemplateBinding Padding}"
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
@ -154,29 +338,8 @@
TextWrapping="{TemplateBinding TextWrapping}" />
</Panel>
</ScrollViewer>
<Button
Name="PART_ClearButton"
Grid.Column="2"
Command="{Binding $parent[TextBox].Clear}"
IsVisible="False"
Theme="{StaticResource InputClearButton}" />
<ToggleButton
Name="PART_RevealButton"
Grid.Column="3"
Margin="4,0,0,0"
IsChecked="{TemplateBinding RevealPassword,
Mode=TwoWay}"
IsVisible="False"
Theme="{StaticResource InputToggleButton}" />
<ContentPresenter
Grid.Column="4"
Padding="{DynamicResource TextBoxInnerRightContentPadding}"
VerticalAlignment="Center"
Content="{TemplateBinding InnerRightContent}"
Foreground="{DynamicResource TextBoxInnerForeground}"
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerRightContent, Converter={x:Static ObjectConverters.IsNotNull}}" />
</Grid>
</Border>
</Border>
</DataValidationErrors>
</ControlTemplate>
</Setter>
@ -196,40 +359,23 @@
<Style Selector="^:disabled">
<Setter Property="TextBox.Foreground" Value="{DynamicResource TextBoxDisabledForeground}" />
</Style>
<Style Selector="^.clearButton, ^.ClearButton">
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:focus:not(:empty) /template/ Button#PART_ClearButton">
<Setter Property="Button.IsVisible" Value="True" />
</Style>
<Style Selector="^[AcceptsReturn=False][IsReadOnly=False]:pointerover:not(:empty) /template/ Button#PART_ClearButton">
<Setter Property="Button.IsVisible" Value="True" />
</Style>
</Style>
<Style Selector="^.revealPasswordButton, ^.RevealPasswordButton">
<Style Selector="^ /template/ ToggleButton#PART_RevealButton">
<Setter Property="ToggleButton.IsVisible" Value="True" />
</Style>
</Style>
<Style Selector="^.Large">
<Setter Property="TextBox.MinHeight" Value="{DynamicResource TextBoxWrapperLargeHeight}" />
</Style>
<Style Selector="^.Small">
<Setter Property="TextBox.MinHeight" Value="{DynamicResource TextBoxWrapperSmallHeight}" />
</Style>
<Style Selector="^.Bordered">
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxBorderedDefaultBackground}" />
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxBorderedDefaultBorderBrush}" />
<Style Selector="^:error">
<Style Selector="^ /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Background" Value="{DynamicResource DataValidationErrorsBackground}" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:pointerover /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource TextBoxBorderedPointeroverBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource TextBoxBorderedPointeroverBorderBrush}" />
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsPointerOverBackground}" />
<Setter Property="Border.BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:focus">
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxBorderedPointeroverBackground}" />
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxBorderedPointeroverBorderBrush}" />
<Style Selector="^:pressed /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsPressedBackground}" />
<Setter Property="Border.BorderBrush" Value="Transparent" />
</Style>
<Style Selector="^:disabled /template/ Border#PART_ContentPresenterBorder">
<Setter Property="TextBox.Background" Value="{DynamicResource TextBoxDisabledBackground}" />
<Setter Property="TextBox.BorderBrush" Value="{DynamicResource TextBoxDisabledBorderBrush}" />
<Style Selector="^:focus /template/ Border#PART_ContentPresenterBorder">
<Setter Property="Border.Background" Value="{DynamicResource DataValidationErrorsSelectedBackground}" />
<Setter Property="Border.BorderBrush" Value="{DynamicResource DataValidationErrorsSelectedBorderBrush}" />
</Style>
</Style>
</ControlTheme>

View File

@ -129,7 +129,6 @@
</ControlTheme>
<ControlTheme x:Key="{x:Type TimePicker}" TargetType="TimePicker">
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonDefaultHeight}" />
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonForeground}" />
<Setter Property="Background" Value="{DynamicResource DateTimePickerButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonBorderBrush}" />
@ -139,106 +138,110 @@
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Template">
<ControlTemplate>
<Grid Name="LayoutRoot" Margin="{TemplateBinding Padding}">
<Button
x:Name="PART_FlyoutButton"
Width="242"
MinWidth="242"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Cursor="Hand"
Foreground="{TemplateBinding Foreground}"
IsEnabled="{TemplateBinding IsEnabled}"
Theme="{StaticResource DateTimePickerFlyoutButton}">
<Grid ColumnDefinitions="*, Auto">
<Grid Name="PART_FlyoutButtonContentGrid" Grid.Column="0">
<!-- Ignore col defs here, set in code -->
<Border
x:Name="PART_FirstPickerHost"
Grid.Column="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock
x:Name="PART_HourTextBlock"
Padding="12,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" />
</Border>
<DataValidationErrors>
<Grid Name="LayoutRoot" Margin="{TemplateBinding Padding}">
<Button
x:Name="PART_FlyoutButton"
Width="242"
MinWidth="242"
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}"
MinHeight="{DynamicResource DateTimePickerButtonDefaultHeight}"
Theme="{StaticResource DateTimePickerFlyoutButton}">
<Grid ColumnDefinitions="*, Auto">
<Grid Name="PART_FlyoutButtonContentGrid" Grid.Column="0">
<!-- Ignore col defs here, set in code -->
<Border
x:Name="PART_FirstPickerHost"
Grid.Column="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock
x:Name="PART_HourTextBlock"
Padding="12,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" />
</Border>
<Rectangle
Name="PART_FirstColumnDivider"
<Rectangle
Name="PART_FirstColumnDivider"
Grid.Column="1"
Width="1"
Margin="0,4"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
<Border
x:Name="PART_SecondPickerHost"
Grid.Column="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock
x:Name="PART_MinuteTextBlock"
Padding="12,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" />
</Border>
<Rectangle
Name="PART_SecondColumnDivider"
Grid.Column="3"
Width="1"
Margin="0,4"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
<Border
x:Name="PART_ThirdPickerHost"
Grid.Column="4"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock
x:Name="PART_PeriodTextBlock"
Padding="12,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" />
</Border>
</Grid>
<PathIcon
Name="PART_Icon"
Grid.Column="1"
Width="1"
Margin="0,4"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
<Border
x:Name="PART_SecondPickerHost"
Grid.Column="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock
x:Name="PART_MinuteTextBlock"
Padding="12,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" />
</Border>
<Rectangle
Name="PART_SecondColumnDivider"
Grid.Column="3"
Width="1"
Margin="0,4"
HorizontalAlignment="Center"
Fill="{DynamicResource DateTimePickerSeparatorBackground}" />
<Border
x:Name="PART_ThirdPickerHost"
Grid.Column="4"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock
x:Name="PART_PeriodTextBlock"
Padding="12,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" />
</Border>
Width="16"
Height="16"
Margin="0,0,8,0"
Data="{DynamicResource TimePickerIconGlyph}"
Foreground="{DynamicResource DateTimePickerIconForeground}" />
</Grid>
<PathIcon
Name="PART_Icon"
Grid.Column="1"
Width="16"
Height="16"
Margin="0,0,8,0"
Data="{DynamicResource TimePickerIconGlyph}"
Foreground="{DynamicResource DateTimePickerIconForeground}" />
</Grid>
</Button>
</Button>
<Popup
Name="PART_Popup"
IsLightDismissEnabled="True"
Placement="Bottom"
PlacementTarget="{TemplateBinding}"
WindowManagerAddShadowHint="False">
<TimePickerPresenter Name="PART_PickerPresenter" />
</Popup>
</Grid>
<Popup
Name="PART_Popup"
IsLightDismissEnabled="True"
Placement="Bottom"
PlacementTarget="{TemplateBinding}"
WindowManagerAddShadowHint="False">
<TimePickerPresenter Name="PART_PickerPresenter" />
</Popup>
</Grid>
</DataValidationErrors>
</ControlTemplate>
</Setter>
@ -250,10 +253,10 @@
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerEmptyForeground}" />
</Style>
<Style Selector="^.Large">
<Style Selector="^.Large /template/ Button#PART_FlyoutButton">
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonLargeHeight}" />
</Style>
<Style Selector="^.Small">
<Style Selector="^.Small /template/ Button#PART_FlyoutButton">
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonSmallHeight}" />
</Style>
</ControlTheme>

View File

@ -13,6 +13,7 @@
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Dark/Carousel.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Dark/CheckBox.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Dark/ComboBox.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Dark/DataValidationErrors.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Dark/DatePicker.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Dark/DateTimePickerShared.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Dark/DropDownButton.axaml" />

View File

@ -0,0 +1,12 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<SolidColorBrush x:Key="DataValidationErrorsForeground" Color="#FFFC725A" />
<SolidColorBrush x:Key="DataValidationErrorsBackground" Opacity="0.2" Color="#FFFC725A" />
<SolidColorBrush x:Key="DataValidationErrorsBorderBrush" Opacity="0.2" Color="#FFFC725A" />
<SolidColorBrush x:Key="DataValidationErrorsPointerOverBackground" Opacity="0.3" Color="#FFFC725A" />
<SolidColorBrush x:Key="DataValidationErrorsPointerOverBorderBrush" Opacity="0.3" Color="#FFFC725A" />
<SolidColorBrush x:Key="DataValidationErrorsPressedBackground" Opacity="0.4" Color="#FFFC725A" />
<SolidColorBrush x:Key="DataValidationErrorsPressedBorderBrush" Opacity="0.4" Color="#FFFC725A" />
<SolidColorBrush x:Key="DataValidationErrorsSelectedBackground" Opacity="0.2" Color="#FFFC725A" />
<SolidColorBrush x:Key="DataValidationErrorsSelectedBorderBrush" Color="#FFFC725A" />
</ResourceDictionary>

View File

@ -0,0 +1,12 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Add Resources Here -->
<SolidColorBrush x:Key="DataValidationErrorsForeground" Color="#FFF93920" />
<SolidColorBrush x:Key="DataValidationErrorsBackground" Color="#FFFEF2ED" />
<SolidColorBrush x:Key="DataValidationErrorsBorderBrush" Color="#FFFEF2ED" />
<SolidColorBrush x:Key="DataValidationErrorsPointerOverBackground" Color="#FFFEDDD2" />
<SolidColorBrush x:Key="DataValidationErrorsPointerOverBorderBrush" Color="#FFFEDDD2" />
<SolidColorBrush x:Key="DataValidationErrorsPressedBackground" Color="#FFFDB7A5" />
<SolidColorBrush x:Key="DataValidationErrorsPressedBorderBrush" Color="#FFFDB7A5" />
<SolidColorBrush x:Key="DataValidationErrorsSelectedBackground" Color="#FFFEF2ED" />
<SolidColorBrush x:Key="DataValidationErrorsSelectedBorderBrush" Color="#FFF93920" />
</ResourceDictionary>

View File

@ -12,6 +12,7 @@
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/Carousel.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/CheckBox.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/ComboBox.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/DataValidationErrors.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/DatePicker.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/DateTimePickerShared.axaml" />
<ResourceInclude Source="avares://Semi.Avalonia/Themes/Light/DropDownButton.axaml" />