Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:s="clr-namespace:System;assembly=mscorlib"
- xmlns:sys="clr-namespace:System;assembly=mscorlib"
- xmlns:local="clr-namespace:Downloader.App.ResourceDictionaries.NamedStyles">
- <Style x:Key="TextBoxWithDefaultTextStyle" TargetType="TextBox">
- <!--Padding for typed text-->
- <Setter Property="Padding" Value="5, 2, 5, 0"/>
- <Setter Property="Background" Value="White" />
- <Setter Property="BorderBrush" Value="#FF858585" />
- <Setter Property="BorderThickness" Value="3" />
- <Setter Property="Border.CornerRadius" Value="10" />
- <Setter Property="Control.Template" Value="{StaticResource TextBoxBaseControlTemplate}"></Setter>
- <Style.Triggers>
- <Trigger Property="Validation.HasError" Value="True">
- <Setter Property="Validation.ErrorTemplate">
- <Setter.Value>
- <ControlTemplate>
- <DockPanel>
- <Border BorderBrush="Brown" BorderThickness="5"
- CornerRadius="2">
- <AdornedElementPlaceholder x:Name="controlWithError"/>
- </Border>
- <TextBlock Foreground="Red" FontSize="20" FontFamily="Segoe UI" Margin="3,0,0,0">!</TextBlock>
- </DockPanel>
- <ControlTemplate.Triggers>
- <Trigger Property="Validation.HasError" Value="true">
- <Setter Property="Background" Value="Red"/>
- <Setter Property="Foreground" Value="White"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Trigger>
- </Style.Triggers>
- </Style>
- </ResourceDictionary>
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:s="clr-namespace:System;assembly=mscorlib"
- xmlns:sys="clr-namespace:System;assembly=mscorlib"
- xmlns:local="clr-namespace:Downloader.App.ResourceDictionaries.NamedStyles">
- <Style x:Key="TextBoxWithDefaultTextStyle" TargetType="TextBox">
- <!--Padding for typed text-->
- <Setter Property="Padding" Value="5, 2, 5, 0"/>
- <Setter Property="Background" Value="White" />
- <Setter Property="BorderBrush" Value="#FF858585" />
- <Setter Property="BorderThickness" Value="3" />
- <Setter Property="Border.CornerRadius" Value="10" />
- <Setter Property="Control.Template" Value="{StaticResource TextBoxBaseControlTemplate}"></Setter>
- <Setter Property="Validation.ErrorTemplate" Value="{StaticResource TextBoxValidationTemplate}"></Setter>
- </Style>
- </ResourceDictionary>
- <AdornedElementPlaceholder x:Name="controlWithError"/>
- </Border>
- <TextBlock Foreground="Red" FontSize="20" FontFamily="Segoe UI" Margin="3,0,0,0">!</TextBlock>
- </DockPanel>
- <ControlTemplate.Triggers>
- <Trigger Property="Validation.HasError" Value="true">
- <Setter Property="Background" Value="Red"/>
- <Setter Property="Foreground" Value="White"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <TextBox Text="{Binding UserName, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged}"
- Validation.ErrorTemplate="{StaticResource TextBoxValidationTemplate}"
- Style="{StaticResource TextBoxWithDefaultTextStyle}"
- Grid.Row="2"
- Grid.Column="0"
- Margin="5,2,5,2"
- Grid.ColumnSpan="2"/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement