-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathValidationContainer.xaml
More file actions
65 lines (59 loc) · 3.79 KB
/
Copy pathValidationContainer.xaml
File metadata and controls
65 lines (59 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:SyncPro.UI.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/XamlResources.xaml" />
<ResourceDictionary Source="/Converters.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type controls:ValidationContainer}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:ValidationContainer}">
<Border BorderThickness="0" Margin="{TemplateBinding Margin}">
<Grid Margin="0,0,0,-17">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.Column="0" Grid.Row="0" BorderThickness="0,0,0,2">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=controls:ValidationContainer}, Path=HasValidationErrors}"
Value="True">
<Setter Property="BorderBrush" Value="Red" />
</DataTrigger>
</Style.Triggers>
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
</Border.Style>
<ContentPresenter Content="{TemplateBinding Content}" />
</Border>
<Image Grid.Column="1" Grid.Row="0"
Source="/Resources/Graphics/exclaim_14.png" Height="14" UseLayoutRounding="True" SnapsToDevicePixels="True"
Visibility="{TemplateBinding HasValidationErrors, Converter={StaticResource BooleanToVisibilityCollapsed}}"
VerticalAlignment="Center" Margin="2,0,0,0">
<Image.ToolTip>
<ItemsControl ItemsSource="{TemplateBinding Errors}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Message}" Foreground="Red"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Image.ToolTip>
</Image>
<TextBlock Grid.Column="0" Grid.Row="1" Margin="0,-1,0,0"
Text="Required Field" FontSize="11" Foreground="#EE4444" HorizontalAlignment="Right"
Visibility="{TemplateBinding IsRequired, Converter={StaticResource BooleanToVisibility}}"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>