-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserWindow.xaml
More file actions
219 lines (209 loc) · 11.8 KB
/
UserWindow.xaml
File metadata and controls
219 lines (209 loc) · 11.8 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.UserWindow"
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:local="clr-namespace:QLBH"
mc:Ignorable="d"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:uc="clr-namespace:QLBH.UserControlQ"
xmlns:rules="clr-namespace:QLBH.ValidationRules"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextElement.FontWeight="Regular"
TextElement.FontSize="13"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}"
DataContext="{StaticResource UserVM}"
WindowStyle="None"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Name="Window"
Title="Người dùng" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<uc:ControlBarUC Tag="{Binding Title,ElementName=Window}"></uc:ControlBarUC>
</Grid>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<materialDesign:Card Grid.Row="0" Margin="5">
<WrapPanel>
<TextBox
Margin="5 5 15 10"
materialDesign:HintAssist.Hint="Tên đăng nhập"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
rules:ValidationBehavior.HasError="{Binding ValidateErrorUserName}"
>
<TextBox.Text>
<Binding Path="UserName" UpdateSourceTrigger="PropertyChanged" >
<Binding.ValidationRules>
<rules:NotEmptyRule ValidatesOnTargetUpdated="True"></rules:NotEmptyRule>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<ComboBox
Margin="5 5 15 -4"
materialDesign:HintAssist.Hint="Chức vụ"
IsEditable="False"
ItemsSource="{Binding ListUserRole}"
DisplayMemberPath="DisplayName"
SelectedItem="{Binding SelectedUserRole , Mode=TwoWay , UpdateSourceTrigger=PropertyChanged}">
<ComboBox.Text>
<Binding Path="SelectedUserRoleText" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<rules:NotEmptyRule ValidatesOnTargetUpdated="True"></rules:NotEmptyRule>
</Binding.ValidationRules>
</Binding>
</ComboBox.Text>
</ComboBox>
<TextBox
IsReadOnly="False"
Margin="5 5 15 10"
materialDesign:HintAssist.Hint="Tên hiển thị"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
rules:ValidationBehavior.HasError="{Binding ValidateErrorDisplayName}"
>
<TextBox.Text>
<Binding Path="DisplayName" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<rules:NotEmptyRule ValidatesOnTargetUpdated="True"></rules:NotEmptyRule>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox Margin="5 15 5 5" VerticalAlignment="Center" Text="Ảnh đại diện"></TextBox>
<Rectangle Visibility="{Binding Avatar,UpdateSourceTrigger=PropertyChanged}" Stroke="Green" x:Name="Avatar" Margin="0 0 0 0" HorizontalAlignment="Center" Height="50" Width="50" >
<Rectangle.Fill>
<ImageBrush x:Name="Image" ImageSource="{Binding FileName}"/>
</Rectangle.Fill>
</Rectangle>
<Rectangle Visibility="{Binding NoImage,UpdateSourceTrigger=PropertyChanged}" Stroke="Green" Margin="0 0 0 0" HorizontalAlignment="Center" Height="50" Width="50" >
<Rectangle.Fill>
<ImageBrush x:Name="NoImage" ImageSource="/Images/noimage.jpg"/>
</Rectangle.Fill>
</Rectangle>
<StackPanel>
<Button x:Name="CloseImageButton" HorizontalAlignment="Left" Margin="-10 5 0 0" Width="10" Height="10" Content=""
Command="{Binding CloseImageCommand}"
CommandParameter="{Binding ElementName=CloseImageButton}"
Visibility="{Binding CloseButtonVisibility, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
>
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Ellipse Fill="Red"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center">
<ContentPresenter.Content>
<materialDesign:PackIcon Width="10" Height="10" Kind="CloseCircle" />
</ContentPresenter.Content>
</ContentPresenter>
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
<Button
Width="80"
Height="25"
Margin="5 10 0 0"
Style="{StaticResource MaterialDesignRaisedAccentButton}"
ToolTip="Resource name: MaterialDesignRaisedAccentButton"
FontSize="12"
Content="Chọn file"
Command="{Binding ImageCommand}"
CommandParameter="{Binding ElementName=Image}"
/>
</StackPanel>
</WrapPanel>
</materialDesign:Card>
<materialDesign:Card Grid.Row="1" Margin="5">
<WrapPanel>
<Button
Width="100"
Margin="5"
Style="{StaticResource MaterialDesignRaisedAccentButton}"
ToolTip="Resource name: MaterialDesignRaisedAccentButton"
Content="Thêm"
Command="{Binding AddCommand}"
CommandParameter="{Binding ElementName=List}"
/>
<Button
Width="100"
Margin="5"
Style="{StaticResource MaterialDesignRaisedAccentButton}"
ToolTip="Resource name: MaterialDesignRaisedAccentButton"
Content="Sửa"
Command="{Binding EditCommand}"
CommandParameter="{Binding ElementName=List}"
/>
<Button
Width="100"
Margin="5"
Style="{StaticResource MaterialDesignRaisedAccentButton}"
ToolTip="Resource name: MaterialDesignRaisedAccentButton"
Content="Xóa"
Command="{Binding DeleteCommand}"
/>
<Button
Width="150"
Margin="5"
Style="{StaticResource MaterialDesignRaisedAccentButton}"
ToolTip="Resource name: MaterialDesignRaisedAccentButton"
Content="Đổi mật khẩu"
Command="{Binding ChangePasswordCommand}"
/>
</WrapPanel>
</materialDesign:Card>
<materialDesign:Card Margin="5" Grid.Row="2" VerticalAlignment="Stretch">
<ListView x:Name="List" ItemsSource="{Binding List}" SelectedItem="{Binding SelectedItem,Mode=OneWayToSource}">
<ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding ID}">
<GridViewColumnHeader Content="ID" Width="40" Padding="7"/>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding UserName}">
<GridViewColumnHeader Content="Tên đăng nhập" Width="120" Padding="7"/>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding UserRole.DisplayName}">
<GridViewColumnHeader Content="Chức vụ" Width="90" Padding="7"/>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding DisplayName}">
<GridViewColumnHeader Content="Tên hiển thị" Width="120" Padding="7"/>
</GridViewColumn>
<GridViewColumn>
<GridViewColumnHeader Content="Ảnh chân dung" Width="120" Padding="7"/>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Rectangle x:Name="Avatar" Margin="0 0 0 0" HorizontalAlignment="Center" Height="50" Width="50" >
<Rectangle.Fill>
<ImageBrush ImageSource="{Binding Image}"/>
</Rectangle.Fill>
</Rectangle>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding Note}">
<GridViewColumnHeader Foreground="Red" Content="Chú ý" Width="378" Padding="7"/>
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Foreground="Red">
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</materialDesign:Card>
</Grid>
</Grid>
</Window>