-
Notifications
You must be signed in to change notification settings - Fork 1
/
RegistrationView.xaml
113 lines (113 loc) · 6.71 KB
/
RegistrationView.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
111
112
113
<UserControl x:Class="RegistrationForm.View.RegistrationView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:ViewModel="clr-namespace:RegistrationForm.ViewModel"
xmlns:DataModel="clr-namespace:RegistrationForm.DataModel"
xmlns:Common="clr-namespace:RegistrationForm.Common"
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="400"
DataContext="{dxmvvm:ViewModelSource {x:Type ViewModel:RegistrationViewModel}}">
<UserControl.Resources>
<Style x:Key="labelStyle" TargetType="dxlc:LayoutItemLabel">
<Setter Property="FontWeight" Value="Bold"/>
</Style>
<Style x:Key="itemStyle" TargetType="dxlc:LayoutItem">
<Setter Property="LabelPosition" Value="Top"/>
<Setter Property="LabelStyle" Value="{StaticResource labelStyle}"/>
</Style>
</UserControl.Resources>
<Grid>
<dxlc:LayoutControl x:Name="container" dxe:ValidationService.IsValidationContainer="True"
Orientation="Vertical" ItemStyle="{StaticResource itemStyle}" ItemSpace="10">
<dxlc:LayoutGroup ItemSpace="10">
<dxlc:LayoutItem Label="Name">
<dxe:TextEdit NullText="FIRST" ValidateOnEnterKeyPressed="True" ValidateOnTextInput="False">
<dxe:TextEdit.EditValue>
<Binding Path="FirstName" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
<Binding.ValidationRules>
<Common:RequiredValidationRule FieldName="First Name"/>
</Binding.ValidationRules>
</Binding>
</dxe:TextEdit.EditValue>
</dxe:TextEdit>
</dxlc:LayoutItem>
<dxe:TextEdit VerticalAlignment="Bottom" NullText="LAST">
<dxe:TextEdit.EditValue>
<Binding Path="LastName" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
<Binding.ValidationRules>
<Common:RequiredValidationRule FieldName="Last Name"/>
</Binding.ValidationRules>
</Binding>
</dxe:TextEdit.EditValue>
</dxe:TextEdit>
</dxlc:LayoutGroup>
<dxlc:LayoutItem Label="Email">
<dxe:TextEdit MaskType="RegEx"
Mask="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}"
MaskIgnoreBlank="True" InvalidValueBehavior="AllowLeaveEditor">
<dxe:TextEdit.EditValue>
<Binding Path="Email" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
<Binding.ValidationRules>
<Common:RequiredValidationRule FieldName="Email"/>
</Binding.ValidationRules>
</Binding>
</dxe:TextEdit.EditValue>
</dxe:TextEdit>
</dxlc:LayoutItem>
<dxlc:LayoutItem Label="Create a password">
<dxe:PasswordBoxEdit>
<dxe:PasswordBoxEdit.EditValue>
<Binding Path="Password" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
<Binding.ValidationRules>
<Common:RequiredValidationRule FieldName="Password"/>
</Binding.ValidationRules>
</Binding>
</dxe:PasswordBoxEdit.EditValue>
</dxe:PasswordBoxEdit>
</dxlc:LayoutItem>
<dxlc:LayoutItem Label="Confirm your password">
<dxe:PasswordBoxEdit EditValue="{Binding ConfirmPassword}"
ValidateOnEnterKeyPressed="True" ValidateOnTextInput="True"/>
</dxlc:LayoutItem>
<dxlc:LayoutItem Label="Birthday">
<dxe:DateEdit InvalidValueBehavior="AllowLeaveEditor"
MinValue="{Binding MinBirthday}" MaxValue="{Binding MaxBirthday}">
<dxe:DateEdit.EditValue>
<Binding Path="Birthday" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
<Binding.ValidationRules>
<Common:RequiredValidationRule FieldName="Birthday"/>
</Binding.ValidationRules>
</Binding>
</dxe:DateEdit.EditValue>
<dxe:DateEdit.StyleSettings>
<dxe:DateEditPickerStyleSettings/>
</dxe:DateEdit.StyleSettings>
</dxe:DateEdit>
</dxlc:LayoutItem>
<dxlc:LayoutItem Label="Gender">
<dxe:ComboBoxEdit NullText="I am..."
ItemsSource="{x:Static Member=DataModel:GenderList.Source}"
ValueMember="ID" DisplayMember="Description">
<dxe:ComboBoxEdit.EditValue>
<Binding Path="Gender" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
<Binding.ValidationRules>
<Common:RequiredValidationRule FieldName="Gender"/>
</Binding.ValidationRules>
</Binding>
</dxe:ComboBoxEdit.EditValue>
<dxe:ComboBoxEdit.NullValue>
<sys:Int32>-1</sys:Int32>
</dxe:ComboBoxEdit.NullValue>
</dxe:ComboBoxEdit>
</dxlc:LayoutItem>
<Button Content="Register" HorizontalAlignment="Center" VerticalAlignment="Bottom" Width="80"
Command="{Binding AddEmployeeCommand}"
IsEnabled="{Binding ElementName=container, Path=(dxe:ValidationService.HasValidationError), Converter={dxmvvm:BooleanNegationConverter}}"/>
</dxlc:LayoutControl>
</Grid>
</UserControl>