Merge pull request #180 from irihitech/178-datavalidationerror
Add DataValidationError to Input Control
This commit is contained in:
commit
37746e38f7
83
demo/Semi.Avalonia.Demo/Pages/DataValidationErrorsDemo.axaml
Normal file
83
demo/Semi.Avalonia.Demo/Pages/DataValidationErrorsDemo.axaml
Normal 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>
|
@ -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);
|
||||
}
|
||||
}
|
@ -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">
|
||||
|
@ -105,6 +105,9 @@
|
||||
<TabItem Header="ComboBox">
|
||||
<pages:ComboBoxDemo />
|
||||
</TabItem>
|
||||
<TabItem Header="DataValidationErrors">
|
||||
<pages:DataValidationErrorsDemo />
|
||||
</TabItem>
|
||||
<TabItem Header="DataGrid">
|
||||
<pages:DataGridDemo />
|
||||
</TabItem>
|
||||
|
@ -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>
|
||||
|
@ -12,11 +12,13 @@
|
||||
<Setter Property="AutoCompleteBox.MaxDropDownHeight" Value="{DynamicResource AutoCompleteMaxDropdownHeight}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="AutoCompleteBox">
|
||||
<DataValidationErrors>
|
||||
<Panel>
|
||||
<TextBox
|
||||
Name="PART_TextBox"
|
||||
VerticalAlignment="Center"
|
||||
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
||||
Theme="{DynamicResource NonErrorTextBox}"
|
||||
Watermark="{TemplateBinding Watermark}" />
|
||||
<Popup
|
||||
Name="PART_Popup"
|
||||
@ -41,6 +43,7 @@
|
||||
</Border>
|
||||
</Popup>
|
||||
</Panel>
|
||||
</DataValidationErrors>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
|
@ -34,10 +34,10 @@
|
||||
<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">
|
||||
<DataValidationErrors>
|
||||
<Panel
|
||||
x:Name="LayoutRoot"
|
||||
HorizontalAlignment="Stretch"
|
||||
@ -55,7 +55,7 @@
|
||||
<TextBox
|
||||
Name="PART_TextBox"
|
||||
Grid.Column="0"
|
||||
MinHeight="{DynamicResource CalendarDatePickerInnerDefaultHeight}"
|
||||
MinHeight="{DynamicResource CalendarDatePickerDefaultHeight}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
@ -65,6 +65,7 @@
|
||||
BorderThickness="0"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
Theme="{DynamicResource NonErrorTextBox}"
|
||||
UseFloatingWatermark="{TemplateBinding UseFloatingWatermark}"
|
||||
Watermark="{TemplateBinding Watermark}">
|
||||
<TextBox.Styles>
|
||||
@ -124,17 +125,17 @@
|
||||
</Border>
|
||||
|
||||
</Panel>
|
||||
</DataValidationErrors>
|
||||
|
||||
</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>
|
||||
|
@ -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,11 +44,13 @@
|
||||
<Setter Property="PlaceholderForeground" Value="{DynamicResource ComboBoxPlaceHolderForeground}" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
<DataValidationErrors>
|
||||
<Grid ColumnDefinitions="*,32">
|
||||
<Border
|
||||
x:Name="Background"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
MinHeight="{DynamicResource ComboBoxDefaultHeight}"
|
||||
MinWidth="{DynamicResource ComboBoxThemeMinWidth}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
@ -62,8 +63,7 @@
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
IsVisible="{TemplateBinding SelectionBoxItem,
|
||||
Converter={x:Static ObjectConverters.IsNull}}"
|
||||
IsVisible="{TemplateBinding SelectionBoxItem,Converter={x:Static ObjectConverters.IsNull}}"
|
||||
Opacity="0.3"
|
||||
Text="{TemplateBinding PlaceholderText}" />
|
||||
<ContentPresenter
|
||||
@ -105,8 +105,7 @@
|
||||
ClipToBounds="False"
|
||||
InheritsTransform="True"
|
||||
IsLightDismissEnabled="True"
|
||||
IsOpen="{TemplateBinding IsDropDownOpen,
|
||||
Mode=TwoWay}"
|
||||
IsOpen="{TemplateBinding IsDropDownOpen,Mode=TwoWay}"
|
||||
PlacementTarget="Background"
|
||||
WindowManagerAddShadowHint="False">
|
||||
<Border
|
||||
@ -119,7 +118,9 @@
|
||||
BoxShadow="{DynamicResource ComboBoxPopupBoxShadow}"
|
||||
ClipToBounds="True"
|
||||
CornerRadius="6">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
|
||||
<ScrollViewer
|
||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
|
||||
<ItemsPresenter
|
||||
Name="PART_ItemsPresenter"
|
||||
Margin="{DynamicResource ComboBoxDropdownContentMargin}"
|
||||
@ -128,13 +129,14 @@
|
||||
</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>
|
||||
|
||||
|
@ -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" />
|
||||
|
108
src/Semi.Avalonia/Controls/DataValidationErrors.axaml
Normal file
108
src/Semi.Avalonia/Controls/DataValidationErrors.axaml
Normal 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>
|
@ -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,6 +134,7 @@
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="DatePicker">
|
||||
<DataValidationErrors>
|
||||
<Grid Name="LayoutRoot" Margin="{TemplateBinding Padding}">
|
||||
<Button
|
||||
Name="PART_FlyoutButton"
|
||||
@ -147,8 +147,10 @@
|
||||
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
|
||||
@ -219,6 +221,7 @@
|
||||
</Popup>
|
||||
|
||||
</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>
|
||||
|
@ -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 -->
|
||||
|
@ -5,10 +5,10 @@
|
||||
<!-- 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">
|
||||
<DataValidationErrors>
|
||||
<ButtonSpinner
|
||||
Name="PART_Spinner"
|
||||
MinWidth="0"
|
||||
@ -23,27 +23,49 @@
|
||||
<TextBox
|
||||
Name="PART_TextBox"
|
||||
Height="{TemplateBinding Height}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
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>
|
@ -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,20 +75,17 @@
|
||||
<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"
|
||||
@ -148,31 +145,25 @@
|
||||
Theme="{StaticResource SliderThumbTheme}" />
|
||||
</Track>
|
||||
</Grid>
|
||||
</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"
|
||||
@ -232,8 +223,7 @@
|
||||
Theme="{StaticResource SliderThumbTheme}" />
|
||||
</Track>
|
||||
</Grid>
|
||||
</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">
|
||||
|
@ -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,8 +103,10 @@
|
||||
<Setter Property="TextBox.ContextFlyout" Value="{StaticResource DefaultTextBoxContextFlyout}" />
|
||||
<Setter Property="TextBox.Template">
|
||||
<ControlTemplate TargetType="TextBox">
|
||||
<DataValidationErrors>
|
||||
<Border
|
||||
Name="PART_ContentPresenterBorder"
|
||||
MinHeight="{DynamicResource TextBoxWrapperDefaultHeight}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
@ -177,6 +178,7 @@
|
||||
IsVisible="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=InnerRightContent, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataValidationErrors>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
@ -196,6 +198,26 @@
|
||||
<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" />
|
||||
@ -209,11 +231,11 @@
|
||||
<Setter Property="ToggleButton.IsVisible" Value="True" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Large">
|
||||
<Setter Property="TextBox.MinHeight" Value="{DynamicResource TextBoxWrapperLargeHeight}" />
|
||||
<Style Selector="^.Large /template/ Border#PART_ContentPresenterBorder">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource TextBoxWrapperLargeHeight}" />
|
||||
</Style>
|
||||
<Style Selector="^.Small">
|
||||
<Setter Property="TextBox.MinHeight" Value="{DynamicResource TextBoxWrapperSmallHeight}" />
|
||||
<Style Selector="^.Small /template/ Border#PART_ContentPresenterBorder">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource TextBoxWrapperSmallHeight}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^.Bordered">
|
||||
@ -231,6 +253,130 @@
|
||||
<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
|
||||
Margin="{TemplateBinding Padding}"
|
||||
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>
|
||||
</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>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
|
@ -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,6 +138,7 @@
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<DataValidationErrors>
|
||||
<Grid Name="LayoutRoot" Margin="{TemplateBinding Padding}">
|
||||
<Button
|
||||
x:Name="PART_FlyoutButton"
|
||||
@ -151,8 +151,10 @@
|
||||
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">
|
||||
@ -239,6 +241,7 @@
|
||||
<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>
|
||||
|
@ -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" />
|
||||
|
12
src/Semi.Avalonia/Themes/Dark/DataValidationErrors.axaml
Normal file
12
src/Semi.Avalonia/Themes/Dark/DataValidationErrors.axaml
Normal 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>
|
12
src/Semi.Avalonia/Themes/Light/DataValidationErrors.axaml
Normal file
12
src/Semi.Avalonia/Themes/Light/DataValidationErrors.axaml
Normal 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>
|
@ -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" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user