12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:controls="clr-namespace:FWindSoft.Wpf.Controls"
- xmlns:wpf="clr-namespace:FWindSoft.Wpf">
- <ControlTemplate x:Key="ErrorTemplate">
- <Border BorderBrush="Red" BorderThickness="1">
- <AdornedElementPlaceholder/>
- </Border>
- </ControlTemplate>
- <Style x:Key="{x:Static wpf:ResourceKeys.ErrorTemplateKey}" TargetType="Control">
- <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ErrorTemplate}">
- </Setter>
- <Style.Triggers>
- <Trigger Property="Validation.HasError" Value="True">
- <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
- </Trigger>
- </Style.Triggers>
- </Style>
- <ControlTemplate x:Key="ErrorTemplate2">
- <DockPanel LastChildFill="true">
- <Border Background="Red" DockPanel.Dock="right" Margin="5,0,0,0" Width="20" Height="20" CornerRadius="10"
- ToolTip="{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
- <TextBlock Text="!" VerticalAlignment="center" HorizontalAlignment="center" FontWeight="Bold" Foreground="white">
- </TextBlock>
- </Border>
- <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center" >
- <Border BorderBrush="Red" BorderThickness="1" />
- </AdornedElementPlaceholder>
- </DockPanel>
-
- </ControlTemplate>
- <Style x:Key="{x:Static wpf:ResourceKeys.ErrorTemplateKey2}" TargetType="Control" >
- <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ErrorTemplate}">
- </Setter>
- <Style.Triggers>
- <Trigger Property="Validation.HasError" Value="True">
- <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
- </Trigger>
- </Style.Triggers>
- </Style>
- <ControlTemplate x:Key="{x:Static wpf:ResourceKeys.EmptyErrorTemplateKey}">
- <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center" >
- </AdornedElementPlaceholder>
- </ControlTemplate>
- </ResourceDictionary>
|