-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathDataValidationDemo.xaml
110 lines (104 loc) · 4.42 KB
/
DataValidationDemo.xaml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<democommon:DemoControl
x:Class="syncfusion.treegriddemos.wpf.DataValidationDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:democommon="clr-namespace:syncfusion.demoscommon.wpf;assembly=syncfusion.demoscommon.wpf"
xmlns:local="clr-namespace:syncfusion.treegriddemos.wpf"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
>
<democommon:DemoControl.DataContext>
<local:DataValidationViewModel />
</democommon:DemoControl.DataContext>
<democommon:DemoControl.Resources>
<democommon:EnumDisplayNameConverter x:Key="enumDisplayNameConverter" />
</democommon:DemoControl.Resources>
<democommon:DemoControl.Options>
<StackPanel Orientation="Vertical">
<Label
x:Name="label1"
Content="Validation Mode"
FontSize="12"
FontWeight="Bold" />
<ComboBox
x:Name="ValidationCombo"
Margin="5"
ItemsSource="{democommon:EnumValuesExtension Type=syncfusion:GridValidationMode}"
SelectedIndex="1">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock VerticalAlignment="Center" Text="{Binding Converter={StaticResource enumDisplayNameConverter}}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Label
x:Name="label2"
Content="Validation Options"
FontSize="12"
FontWeight="Bold" />
<TextBlock
x:Name="textBlock1"
Margin="5"
FontSize="12"
FontWeight="Bold"
Text="Attribute Validations" />
<TextBlock
x:Name="textBlock2"
Margin="5"
FontSize="11"
Text="ContactNo field has been validated with the String Length Attribute, and it should not exceed the string length of 14."
TextWrapping="Wrap" />
<TextBlock
x:Name="textBlock3"
Margin="5"
FontSize="11"
Text="Salary field has a Range attribute, and it can range from 10000 through 30000."
TextWrapping="Wrap" />
<TextBlock
x:Name="textBlock4"
Margin="5"
FontSize="12"
FontWeight="Bold"
Text="IDataErrorInfo Validations" />
<TextBlock
x:Name="textBlock5"
Margin="5"
FontSize="11"
Text="Email field has been validated for its format with the Regex format of Email."
TextWrapping="Wrap" />
</StackPanel>
</democommon:DemoControl.Options>
<Grid>
<syncfusion:SfTreeGrid
Name="treeGrid"
Margin="5"
AllowEditing="True"
AutoExpandMode="RootNodesExpanded"
AutoGenerateColumns="False"
ChildPropertyName="Children"
ColumnSizer="Star"
ExpanderColumn="FirstName"
GridValidationMode="{Binding SelectedValue, ElementName=ValidationCombo}"
ItemsSource="{Binding PersonDetails}"
NavigationMode="Cell"
ShowRowHeader="True">
<syncfusion:SfTreeGrid.Columns>
<syncfusion:TreeGridTextColumn HeaderText="First Name" MappingName="FirstName" />
<syncfusion:TreeGridTextColumn HeaderText="Last Name" MappingName="LastName" />
<syncfusion:TreeGridNumericColumn
HeaderText="ID"
MappingName="ID" NumberDecimalDigits="0" />
<syncfusion:TreeGridTextColumn
HeaderText="Contact No"
MappingName="ContactNo"
TextAlignment="Right" />
<syncfusion:TreeGridCurrencyColumn MappingName="Salary" />
<syncfusion:TreeGridDateTimeColumn MappingName="DOB" TextAlignment="Right" />
<syncfusion:TreeGridTextColumn
Width="200"
HeaderText="E-Mail ID"
MappingName="EMail"
TextAlignment="Left" />
</syncfusion:SfTreeGrid.Columns>
</syncfusion:SfTreeGrid>
</Grid>
</democommon:DemoControl>