-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChangePasswordWindow.xaml
More file actions
219 lines (207 loc) · 13.4 KB
/
ChangePasswordWindow.xaml
File metadata and controls
219 lines (207 loc) · 13.4 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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<Window x:Class="QLBH.ChangePasswordWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:pwb="clr-namespace:QLBH.BindingForComponents"
xmlns:rules="clr-namespace:QLBH.ValidationRules"
mc:Ignorable="d"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:uc="clr-namespace:QLBH.UserControlQ"
DataContext="{StaticResource ChangePasswordVM}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
Background="#FFDFFFDC"
FontFamily="{DynamicResource MaterialDesignFont}"
WindowStyle="None"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Name="Window"
Title="Đổi mật khẩu" Height="350" Width="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<uc:ControlBarUC Tag="{Binding Title,ElementName=Window}"></uc:ControlBarUC>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Vertical">
<TextBlock Text="Đổi mật khẩu" HorizontalAlignment="Center" FontSize="24" FontWeight="Bold" Foreground="Green" Margin="0 10 0 10"></TextBlock>
<materialDesign:Card VerticalAlignment="Center" Margin="5">
<StackPanel >
<Grid Margin="0">
<PasswordBox
Panel.ZIndex="1"
x:Name="NewPasswordBox"
Margin="5 10 5 0"
Foreground="Green"
Style="{StaticResource MaterialDesignFilledPasswordFieldPasswordBox}"
VerticalAlignment="Top"
IsEnabled="{Binding Path=IsChecked, ElementName=MaterialDesignFilledPasswordFieldPasswordBoxEnabledComboBox}"
materialDesign:HintAssist.Hint="Nhập mật khẩu mới"
rules:ValidationBehavior.HasError="{Binding ValidateErrorPassword}"
>
<!--pwb:PasswordBoxAssistant.BindPassword="True"-->
<pwb:PasswordBoxAssistant.BoundPassword >
<Binding Path="NewPassword" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
<Binding.ValidationRules>
<rules:NotEmptyRule ValidatesOnTargetUpdated="True"></rules:NotEmptyRule>
<rules:StringHasWhiteSpaceRule ValidatesOnTargetUpdated="True"></rules:StringHasWhiteSpaceRule>
<rules:StringLongRule ValidatesOnTargetUpdated="True"></rules:StringLongRule>
</Binding.ValidationRules>
</Binding>
</pwb:PasswordBoxAssistant.BoundPassword>
<i:Interaction.Triggers>
<i:EventTrigger EventName="PasswordChanged">
<i:InvokeCommandAction
Command="{Binding PasswordChangedCommand}"
CommandParameter="{Binding ElementName=NewPasswordBox}"
/>
</i:EventTrigger>
</i:Interaction.Triggers>
</PasswordBox>
<TextBox
Text="{Binding NewPassword,UpdateSourceTrigger=PropertyChanged}"
x:Name="ShowNewPasswordTextBox"
Margin="5,30,5.4,0"
Panel.ZIndex="-1"
Visibility="Hidden"
VerticalAlignment="Top"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Height="39"
ForceCursor="True"
Padding="8 -5 0 0"
>
</TextBox>
</Grid>
<Grid Margin="0">
<PasswordBox
x:Name="ConfirmNewPasswordBox"
Margin="5 10 0 10"
Foreground="Green"
Style="{StaticResource MaterialDesignFilledPasswordFieldPasswordBox}"
VerticalAlignment="Top"
IsEnabled="{Binding Path=IsChecked, ElementName=MaterialDesignFilledPasswordFieldPasswordBoxEnabledComboBox}"
materialDesign:HintAssist.Hint="Xác nhận mật khẩu mới"
rules:ValidationBehavior.HasError="{Binding ValidateErrorConfirmPassword}">
<pwb:PasswordBoxAssistant.BoundPassword>
<Binding Path="ConfirmNewPassword" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay">
<Binding.ValidationRules>
<rules:NotEmptyRule ValidatesOnTargetUpdated="True"></rules:NotEmptyRule>
<rules:StringHasWhiteSpaceRule ValidatesOnTargetUpdated="True"></rules:StringHasWhiteSpaceRule>
</Binding.ValidationRules>
</Binding>
</pwb:PasswordBoxAssistant.BoundPassword>
<i:Interaction.Triggers>
<i:EventTrigger EventName="PasswordChanged">
<i:InvokeCommandAction
Command="{Binding PasswordChangedCommand}"
CommandParameter="{Binding ElementName=ConfirmNewPasswordBox}"
/>
</i:EventTrigger>
</i:Interaction.Triggers>
</PasswordBox>
<TextBox
Text="{Binding ConfirmNewPassword,UpdateSourceTrigger=PropertyChanged}"
x:Name="ShowConfirmNewPasswordTextBox"
Margin="5,30,5.4,0"
Panel.ZIndex="-1"
Visibility="Hidden"
VerticalAlignment="Top"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Height="39"
ForceCursor="True"
Padding="8 -5 0 0"
/>
</Grid>
<StackPanel Orientation="Horizontal" Margin="0 10 0 0" VerticalAlignment="Center">
<Grid x:Name="SHPasswordButton" Height="20" Width="20" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="10 0 0 10">
<Button x:Name="ShowPasswordButton" Command="{Binding ShowPasswordCommand}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="0" Width="20" Height="20" BorderBrush="{x:Null}" Background="{x:Null}" >
<Button.CommandParameter>
<MultiBinding Converter="{StaticResource MultiBindingConverter}">
<Binding ElementName="NewPasswordBox"></Binding>
<Binding ElementName="ShowNewPasswordTextBox"></Binding>
<Binding ElementName="ConfirmNewPasswordBox"></Binding>
<Binding ElementName="ShowConfirmNewPasswordTextBox"></Binding>
<Binding ElementName="SHPasswordButton"></Binding>
</MultiBinding>
</Button.CommandParameter>
<materialDesign:PackIcon HorizontalAlignment="Center" Foreground="{Binding EyeColor,UpdateSourceTrigger=PropertyChanged}" Kind="EyeOff" VerticalAlignment="Center"/>
</Button>
<Button x:Name="HiddenPasswordButton" Visibility="Hidden" Command="{Binding HiddenPasswordCommand}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Padding="0" Width="20" Height="20" BorderBrush="{x:Null}" Background="{x:Null}" >
<Button.CommandParameter>
<MultiBinding Converter="{StaticResource MultiBindingConverter}">
<Binding ElementName="NewPasswordBox"></Binding>
<Binding ElementName="ShowNewPasswordTextBox"></Binding>
<Binding ElementName="ConfirmNewPasswordBox"></Binding>
<Binding ElementName="ShowConfirmNewPasswordTextBox"></Binding>
<Binding ElementName="SHPasswordButton"></Binding>
</MultiBinding>
</Button.CommandParameter>
<materialDesign:PackIcon HorizontalAlignment="Center" Foreground="{Binding EyeColor,UpdateSourceTrigger=PropertyChanged}" Kind="Eye" VerticalAlignment="Center"/>
</Button>
</Grid>
<TextBlock Foreground="{Binding ShowPasswordTextStyle}" Padding="2" Text="{Binding ShowPasswordText}"></TextBlock>
</StackPanel>
</StackPanel>
</materialDesign:Card>
<Grid Margin="10 20 10 10">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button
x:Name="submit"
IsDefault="True"
Grid.Column="0"
HorizontalAlignment="Center"
Width="100"
DockPanel.Dock="Left"
Foreground="White"
Background="Blue"
ToolTip="Resource name: MaterialDesignRaisedAccentButton"
Content="Đồng ý"
Command="{Binding SaveNewPasswordCommand}"
CommandParameter="{Binding ElementName=NewPasswordBox}"
>
<!--Cách củ chuối-->
<!--<Button.Style >
<Style TargetType="Button">
<Setter Property="Cursor" Value="Hand"></Setter>
<Setter Property="IsDefault" Value="True"></Setter>
<Setter Property="Background" Value="Blue"></Setter>
<Setter Property="FontSize" Value="14"></Setter>
<Setter Property="IsEnabled" Value="False"/>
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Path=(Validation.HasError), ElementName=NewPassword}" Value="False"/>
</MultiDataTrigger.Conditions>
<Setter Property="IsEnabled" Value="True"/>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Button.Style>-->
</Button>
<Button
Grid.Column="1"
HorizontalAlignment="Center"
Width="100"
Foreground="White"
DockPanel.Dock="Right"
Background="Green"
ToolTip="Resource name: MaterialDesignRaisedAccentButton"
Content="Thoát"
Command="{Binding CloseWindowCommand}"
CommandParameter="{Binding ElementName=Window}"/>
</Grid>
</StackPanel>
</Grid>
</Grid>
</Window>