chore: add avalonia DataValidationErrors demo.
This commit is contained in:
1 parent
5de152b20e
commit
aa67dea033
8 files changed
+246
-162
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Data.Core.Plugins;
|
using Avalonia.Data.Core.Plugins;
|
||||||
@@ -17,7 +18,7 @@ public class App : Application
|
|||||||
public override void OnFrameworkInitializationCompleted()
|
public override void OnFrameworkInitializationCompleted()
|
||||||
{
|
{
|
||||||
Properties.Langs.Lang.Culture = new CultureInfo("en");
|
Properties.Langs.Lang.Culture = new CultureInfo("en");
|
||||||
BindingPlugins.DataValidators.RemoveAt(0);
|
RemoveDefaultDataValidator();
|
||||||
|
|
||||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
{
|
{
|
||||||
@@ -26,4 +27,17 @@ public class App : Application
|
|||||||
|
|
||||||
base.OnFrameworkInitializationCompleted();
|
base.OnFrameworkInitializationCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void RemoveDefaultDataValidator()
|
||||||
|
{
|
||||||
|
// Get an array of plugins to remove
|
||||||
|
var dataValidationPluginsToRemove =
|
||||||
|
BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray();
|
||||||
|
|
||||||
|
// remove each entry found
|
||||||
|
foreach (var plugin in dataValidationPluginsToRemove)
|
||||||
|
{
|
||||||
|
BindingPlugins.DataValidators.Remove(plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,9 @@
|
|||||||
<UserControl xmlns="https://github.com/avaloniaui"
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
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:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
mc:Ignorable="d"
|
xmlns:vm="clr-namespace:HandyControlDemo.ViewModel"
|
||||||
d:DesignWidth="800"
|
x:Class="HandyControlDemo.UserControl.TextBoxDemo"
|
||||||
d:DesignHeight="450"
|
DataContext="{Binding InputElementDemo, Source={x:Static vm:ViewModelLocator.Instance}}">
|
||||||
x:Class="HandyControlDemo.UserControl.TextBoxDemo">
|
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<hc:UniformSpacingPanel Spacing="32"
|
<hc:UniformSpacingPanel Spacing="32"
|
||||||
Margin="32"
|
Margin="32"
|
||||||
@@ -32,6 +29,7 @@
|
|||||||
Text="This is the content"
|
Text="This is the content"
|
||||||
IsEnabled="False" />
|
IsEnabled="False" />
|
||||||
<TextBox Watermark="please enter email"
|
<TextBox Watermark="please enter email"
|
||||||
|
Text="{Binding Email1, UpdateSourceTrigger=PropertyChanged}"
|
||||||
hc:TitleElement.Title="This item must be filled in"
|
hc:TitleElement.Title="This item must be filled in"
|
||||||
Theme="{StaticResource TextBoxExtend}"
|
Theme="{StaticResource TextBoxExtend}"
|
||||||
hc:InfoElement.Necessary="True"
|
hc:InfoElement.Necessary="True"
|
||||||
@@ -44,6 +42,7 @@
|
|||||||
Margin="0,32,0,0"
|
Margin="0,32,0,0"
|
||||||
Text="This is the content" />
|
Text="This is the content" />
|
||||||
<TextBox Width="380"
|
<TextBox Width="380"
|
||||||
|
Text="{Binding Text1, UpdateSourceTrigger=PropertyChanged}"
|
||||||
hc:TitleElement.TitleWidth="120"
|
hc:TitleElement.TitleWidth="120"
|
||||||
Watermark="Please enter content"
|
Watermark="Please enter content"
|
||||||
hc:TitleElement.TitlePlacement="Left"
|
hc:TitleElement.TitlePlacement="Left"
|
||||||
@@ -75,6 +74,7 @@
|
|||||||
Text="This is the content"
|
Text="This is the content"
|
||||||
IsEnabled="False" />
|
IsEnabled="False" />
|
||||||
<TextBox Watermark="please enter email"
|
<TextBox Watermark="please enter email"
|
||||||
|
Text="{Binding Email2, UpdateSourceTrigger=PropertyChanged}"
|
||||||
hc:TitleElement.Title="This item must be filled in"
|
hc:TitleElement.Title="This item must be filled in"
|
||||||
Theme="{StaticResource TextBoxExtend.Small}"
|
Theme="{StaticResource TextBoxExtend.Small}"
|
||||||
hc:InfoElement.Necessary="True"
|
hc:InfoElement.Necessary="True"
|
||||||
@@ -87,6 +87,7 @@
|
|||||||
Margin="0,32,0,0"
|
Margin="0,32,0,0"
|
||||||
Text="This is the content" />
|
Text="This is the content" />
|
||||||
<TextBox Width="380"
|
<TextBox Width="380"
|
||||||
|
Text="{Binding Text2, UpdateSourceTrigger=PropertyChanged}"
|
||||||
hc:TitleElement.TitleWidth="120"
|
hc:TitleElement.TitleWidth="120"
|
||||||
Watermark="Please enter content"
|
Watermark="Please enter content"
|
||||||
hc:TitleElement.TitlePlacement="Left"
|
hc:TitleElement.TitlePlacement="Left"
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
namespace HandyControlDemo.ViewModel;
|
||||||
|
|
||||||
|
public partial class InputElementDemoViewModel : ObservableValidator
|
||||||
|
{
|
||||||
|
[Required] [EmailAddress] [ObservableProperty] [NotifyDataErrorInfo]
|
||||||
|
private string? _email1;
|
||||||
|
|
||||||
|
[Required] [EmailAddress] [ObservableProperty] [NotifyDataErrorInfo]
|
||||||
|
private string? _email2;
|
||||||
|
|
||||||
|
[Required] [ObservableProperty] [NotifyDataErrorInfo]
|
||||||
|
private string? _text1;
|
||||||
|
|
||||||
|
[Required] [ObservableProperty] [NotifyDataErrorInfo]
|
||||||
|
private string? _text2;
|
||||||
|
}
|
||||||
@@ -3,13 +3,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
|||||||
|
|
||||||
namespace HandyControlDemo.ViewModel;
|
namespace HandyControlDemo.ViewModel;
|
||||||
|
|
||||||
public class DemoViewModelBase<T> : ObservableObject
|
public partial class DemoViewModelBase<T> : ObservableObject
|
||||||
{
|
{
|
||||||
private IList<T> _dataList = [];
|
[ObservableProperty] private IList<T> _dataList = [];
|
||||||
|
|
||||||
public IList<T> DataList
|
|
||||||
{
|
|
||||||
get => _dataList;
|
|
||||||
set => SetProperty(ref _dataList, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -19,9 +19,12 @@ public class ViewModelLocator
|
|||||||
|
|
||||||
services.AddSingleton<DataService>();
|
services.AddSingleton<DataService>();
|
||||||
services.AddTransient<MainViewModel>();
|
services.AddTransient<MainViewModel>();
|
||||||
|
services.AddTransient<InputElementDemoViewModel>();
|
||||||
|
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainViewModel Main => _serviceProvider.GetService<MainViewModel>()!;
|
public MainViewModel Main => _serviceProvider.GetService<MainViewModel>()!;
|
||||||
|
|
||||||
|
public InputElementDemoViewModel InputElementDemo => _serviceProvider.GetService<InputElementDemoViewModel>()!;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<ControlTheme x:Key="{x:Type DataValidationErrors}"
|
||||||
|
TargetType="DataValidationErrors">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate>
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<ContentControl x:DataType="DataValidationErrors"
|
||||||
|
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>
|
||||||
|
<Canvas Width="16"
|
||||||
|
Height="16"
|
||||||
|
Margin="4,0,1,0"
|
||||||
|
Background="Transparent">
|
||||||
|
<Canvas.Styles>
|
||||||
|
<Style Selector="ToolTip">
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource DangerBrush}" />
|
||||||
|
</Style>
|
||||||
|
</Canvas.Styles>
|
||||||
|
<ToolTip.Tip>
|
||||||
|
<ItemsControl x:DataType="DataValidationErrors"
|
||||||
|
ItemsSource="{Binding}" />
|
||||||
|
</ToolTip.Tip>
|
||||||
|
<Path Data="{StaticResource WarningGeometry}"
|
||||||
|
Width="16"
|
||||||
|
Height="16"
|
||||||
|
Fill="{DynamicResource DangerBrush}"
|
||||||
|
Stretch="Uniform" />
|
||||||
|
</Canvas>
|
||||||
|
</DataTemplate>
|
||||||
|
</Setter>
|
||||||
|
</ControlTheme>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -97,6 +97,11 @@
|
|||||||
<Setter Property="BorderBrush"
|
<Setter Property="BorderBrush"
|
||||||
Value="{DynamicResource PrimaryBrush}" />
|
Value="{DynamicResource PrimaryBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^:error /template/ Border#border">
|
||||||
|
<Setter Property="BorderBrush"
|
||||||
|
Value="{DynamicResource DangerBrush}" />
|
||||||
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTemplate x:Key="TextBoxExtendTopTemplate"
|
<ControlTemplate x:Key="TextBoxExtendTopTemplate"
|
||||||
@@ -121,77 +126,78 @@
|
|||||||
TextTrimming="CharacterEllipsis"
|
TextTrimming="CharacterEllipsis"
|
||||||
Text="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent}}" />
|
Text="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<Grid Grid.Row="1"
|
<DataValidationErrors Grid.Row="1">
|
||||||
ColumnDefinitions="*,Auto">
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
<Border x:Name="border"
|
<Border x:Name="border"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
Background="{TemplateBinding Background}" />
|
Background="{TemplateBinding Background}" />
|
||||||
<TextBlock Grid.Column="0"
|
<TextBlock Grid.Column="0"
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
Margin="{TemplateBinding Padding}"
|
Margin="{TemplateBinding Padding}"
|
||||||
IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"
|
IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Theme="{StaticResource TextBlockDefaultThiLight}"
|
Theme="{StaticResource TextBlockDefaultThiLight}"
|
||||||
Text="{TemplateBinding Watermark}" />
|
Text="{TemplateBinding Watermark}" />
|
||||||
<ScrollViewer Grid.Column="0"
|
<ScrollViewer Grid.Column="0"
|
||||||
Name="PART_ScrollViewer"
|
Name="PART_ScrollViewer"
|
||||||
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
|
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
|
||||||
BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}"
|
BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}"
|
||||||
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
||||||
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
|
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
|
||||||
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
||||||
<TextPresenter Name="PART_TextPresenter"
|
<TextPresenter Name="PART_TextPresenter"
|
||||||
Margin="{TemplateBinding Padding}"
|
Margin="{TemplateBinding Padding}"
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
||||||
CaretBrush="{TemplateBinding CaretBrush}"
|
CaretBrush="{TemplateBinding CaretBrush}"
|
||||||
CaretIndex="{TemplateBinding CaretIndex}"
|
CaretIndex="{TemplateBinding CaretIndex}"
|
||||||
LineHeight="{TemplateBinding LineHeight}"
|
LineHeight="{TemplateBinding LineHeight}"
|
||||||
LetterSpacing="{TemplateBinding LetterSpacing}"
|
LetterSpacing="{TemplateBinding LetterSpacing}"
|
||||||
PasswordChar="{TemplateBinding PasswordChar}"
|
PasswordChar="{TemplateBinding PasswordChar}"
|
||||||
RevealPassword="{TemplateBinding RevealPassword}"
|
RevealPassword="{TemplateBinding RevealPassword}"
|
||||||
SelectionBrush="{TemplateBinding SelectionBrush}"
|
SelectionBrush="{TemplateBinding SelectionBrush}"
|
||||||
SelectionEnd="{TemplateBinding SelectionEnd}"
|
SelectionEnd="{TemplateBinding SelectionEnd}"
|
||||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||||
SelectionStart="{TemplateBinding SelectionStart}"
|
SelectionStart="{TemplateBinding SelectionStart}"
|
||||||
Text="{TemplateBinding Text,Mode=TwoWay}"
|
Text="{TemplateBinding Text,Mode=TwoWay}"
|
||||||
TextAlignment="{TemplateBinding TextAlignment}"
|
TextAlignment="{TemplateBinding TextAlignment}"
|
||||||
TextWrapping="{TemplateBinding TextWrapping}" />
|
TextWrapping="{TemplateBinding TextWrapping}" />
|
||||||
<ScrollViewer.Styles>
|
<ScrollViewer.Styles>
|
||||||
<Style Selector="ScrollContentPresenter#PART_ContentPresenter">
|
<Style Selector="ScrollContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="Cursor"
|
<Setter Property="Cursor"
|
||||||
Value="IBeam" />
|
Value="IBeam" />
|
||||||
</Style>
|
</Style>
|
||||||
</ScrollViewer.Styles>
|
</ScrollViewer.Styles>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<Button HorizontalContentAlignment="Left"
|
<Button HorizontalContentAlignment="Left"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
hc:IconElement.Width="14"
|
hc:IconElement.Width="14"
|
||||||
Command="{Binding $parent[TextBox].Clear}"
|
Command="{Binding $parent[TextBox].Clear}"
|
||||||
Name="ButtonClear"
|
Name="ButtonClear"
|
||||||
Focusable="False"
|
Focusable="False"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Theme="{StaticResource ButtonIcon}"
|
Theme="{StaticResource ButtonIcon}"
|
||||||
Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}"
|
Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}"
|
||||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||||
Foreground="{Binding BorderBrush,ElementName=border}">
|
Foreground="{Binding BorderBrush,ElementName=border}">
|
||||||
<Button.IsVisible>
|
<Button.IsVisible>
|
||||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||||
Path="IsPointerOver" />
|
Path="IsPointerOver" />
|
||||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||||
Path="(hc:InfoElement.ShowClearButton)" />
|
Path="(hc:InfoElement.ShowClearButton)" />
|
||||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||||
Path="IsReadOnly"
|
Path="IsReadOnly"
|
||||||
Converter="{x:Static BoolConverters.Not}" />
|
Converter="{x:Static BoolConverters.Not}" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</Button.IsVisible>
|
</Button.IsVisible>
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</DataValidationErrors>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
|
||||||
@@ -218,77 +224,78 @@
|
|||||||
TextTrimming="CharacterEllipsis"
|
TextTrimming="CharacterEllipsis"
|
||||||
Text="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent}}" />
|
Text="{Binding Path=(hc:TitleElement.Title), RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<Grid Grid.Column="1"
|
<DataValidationErrors Grid.Column="1">
|
||||||
ColumnDefinitions="*,Auto">
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
<Border x:Name="border"
|
<Border x:Name="border"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
Background="{TemplateBinding Background}" />
|
Background="{TemplateBinding Background}" />
|
||||||
<TextBlock Grid.Column="0"
|
<TextBlock Grid.Column="0"
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
Margin="{TemplateBinding Padding}"
|
Margin="{TemplateBinding Padding}"
|
||||||
IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"
|
IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
Theme="{StaticResource TextBlockDefaultThiLight}"
|
Theme="{StaticResource TextBlockDefaultThiLight}"
|
||||||
Text="{TemplateBinding Watermark}" />
|
Text="{TemplateBinding Watermark}" />
|
||||||
<ScrollViewer Grid.Column="0"
|
<ScrollViewer Grid.Column="0"
|
||||||
Name="PART_ScrollViewer"
|
Name="PART_ScrollViewer"
|
||||||
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
|
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
|
||||||
BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}"
|
BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}"
|
||||||
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
||||||
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
|
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
|
||||||
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
||||||
<TextPresenter Name="PART_TextPresenter"
|
<TextPresenter Name="PART_TextPresenter"
|
||||||
Margin="{TemplateBinding Padding}"
|
Margin="{TemplateBinding Padding}"
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
CaretBlinkInterval="{TemplateBinding CaretBlinkInterval}"
|
||||||
CaretBrush="{TemplateBinding CaretBrush}"
|
CaretBrush="{TemplateBinding CaretBrush}"
|
||||||
CaretIndex="{TemplateBinding CaretIndex}"
|
CaretIndex="{TemplateBinding CaretIndex}"
|
||||||
LineHeight="{TemplateBinding LineHeight}"
|
LineHeight="{TemplateBinding LineHeight}"
|
||||||
LetterSpacing="{TemplateBinding LetterSpacing}"
|
LetterSpacing="{TemplateBinding LetterSpacing}"
|
||||||
PasswordChar="{TemplateBinding PasswordChar}"
|
PasswordChar="{TemplateBinding PasswordChar}"
|
||||||
RevealPassword="{TemplateBinding RevealPassword}"
|
RevealPassword="{TemplateBinding RevealPassword}"
|
||||||
SelectionBrush="{TemplateBinding SelectionBrush}"
|
SelectionBrush="{TemplateBinding SelectionBrush}"
|
||||||
SelectionEnd="{TemplateBinding SelectionEnd}"
|
SelectionEnd="{TemplateBinding SelectionEnd}"
|
||||||
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
|
||||||
SelectionStart="{TemplateBinding SelectionStart}"
|
SelectionStart="{TemplateBinding SelectionStart}"
|
||||||
Text="{TemplateBinding Text,Mode=TwoWay}"
|
Text="{TemplateBinding Text,Mode=TwoWay}"
|
||||||
TextAlignment="{TemplateBinding TextAlignment}"
|
TextAlignment="{TemplateBinding TextAlignment}"
|
||||||
TextWrapping="{TemplateBinding TextWrapping}" />
|
TextWrapping="{TemplateBinding TextWrapping}" />
|
||||||
<ScrollViewer.Styles>
|
<ScrollViewer.Styles>
|
||||||
<Style Selector="ScrollContentPresenter#PART_ContentPresenter">
|
<Style Selector="ScrollContentPresenter#PART_ContentPresenter">
|
||||||
<Setter Property="Cursor"
|
<Setter Property="Cursor"
|
||||||
Value="IBeam" />
|
Value="IBeam" />
|
||||||
</Style>
|
</Style>
|
||||||
</ScrollViewer.Styles>
|
</ScrollViewer.Styles>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<Button HorizontalContentAlignment="Left"
|
<Button HorizontalContentAlignment="Left"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
hc:IconElement.Width="14"
|
hc:IconElement.Width="14"
|
||||||
Command="{Binding $parent[TextBox].Clear}"
|
Command="{Binding $parent[TextBox].Clear}"
|
||||||
Name="ButtonClear"
|
Name="ButtonClear"
|
||||||
Focusable="False"
|
Focusable="False"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Theme="{StaticResource ButtonIcon}"
|
Theme="{StaticResource ButtonIcon}"
|
||||||
Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}"
|
Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSplitConverter}, ConverterParameter='0,0,1,0'}"
|
||||||
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
|
||||||
Foreground="{Binding BorderBrush,ElementName=border}">
|
Foreground="{Binding BorderBrush,ElementName=border}">
|
||||||
<Button.IsVisible>
|
<Button.IsVisible>
|
||||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||||
Path="IsPointerOver" />
|
Path="IsPointerOver" />
|
||||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||||
Path="(hc:InfoElement.ShowClearButton)" />
|
Path="(hc:InfoElement.ShowClearButton)" />
|
||||||
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
<Binding RelativeSource="{RelativeSource TemplatedParent}"
|
||||||
Path="IsReadOnly"
|
Path="IsReadOnly"
|
||||||
Converter="{x:Static BoolConverters.Not}" />
|
Converter="{x:Static BoolConverters.Not}" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</Button.IsVisible>
|
</Button.IsVisible>
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</DataValidationErrors>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
<MergeResourceInclude Source="/Themes/Basic/Brushes.axaml" />
|
<MergeResourceInclude Source="/Themes/Basic/Brushes.axaml" />
|
||||||
<MergeResourceInclude Source="/Themes/Basic/Converters.axaml" />
|
<MergeResourceInclude Source="/Themes/Basic/Converters.axaml" />
|
||||||
|
|
||||||
|
<MergeResourceInclude Source="/Themes/Styles/DataValidationErrors.axaml" />
|
||||||
<MergeResourceInclude Source="/Themes/Styles/TextBlock.axaml" />
|
<MergeResourceInclude Source="/Themes/Styles/TextBlock.axaml" />
|
||||||
<MergeResourceInclude Source="/Themes/Styles/ContentControl.axaml" />
|
<MergeResourceInclude Source="/Themes/Styles/ContentControl.axaml" />
|
||||||
<MergeResourceInclude Source="/Themes/Styles/UserControl.axaml" />
|
<MergeResourceInclude Source="/Themes/Styles/UserControl.axaml" />
|
||||||
@@ -39,9 +40,4 @@
|
|||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Styles.Resources>
|
</Styles.Resources>
|
||||||
|
|
||||||
<Style Selector=":is(UserControl)">
|
|
||||||
<Setter Property="Theme"
|
|
||||||
Value="{DynamicResource {x:Type UserControl}}" />
|
|
||||||
</Style>
|
|
||||||
</Styles>
|
</Styles>
|
||||||
Reference in new issue
Block a user