WinUserAddOrEdit.xaml
5.61 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
<win:BaseWindow
x:Class="HHECS.WinClient.View.UserPermission.WinUserAddOrEdit"
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:local="clr-namespace:HHECS.WinClient.View.UserPermission"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:win="clr-namespace:HHECS.WinCommon.Win;assembly=HHECS.WinCommon"
Title="{Binding Title}"
Width="600"
Height="450"
d:DataContext="{d:DesignInstance Type=local:UserAddOrEditVM}"
mc:Ignorable="d">
<Window.Resources>
<Style x:Key="sp" TargetType="StackPanel">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="Margin" Value="10,5" />
</Style>
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox">
<Setter Property="Width" Value="120" />
</Style>
<DataTemplate x:Key="select">
<CheckBox x:Name="ch" IsChecked="{Binding IsSelected}" />
</DataTemplate>
</Window.Resources>
<Grid x:Name="GridMain">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel
Grid.Row="0"
Grid.Column="0"
Style="{StaticResource sp}">
<TextBlock>编码:</TextBlock>
<TextBox x:Name="TxtUserCode" Text="{Binding User.UserCode, Mode=TwoWay}" />
</StackPanel>
<StackPanel
Grid.Row="0"
Grid.Column="1"
Style="{StaticResource sp}">
<TextBlock>名字:</TextBlock>
<TextBox x:Name="TxtUserName" Text="{Binding User.UserName, Mode=TwoWay}" />
</StackPanel>
<StackPanel
Grid.Row="1"
Grid.Column="0"
Style="{StaticResource sp}">
<TextBlock>密码:</TextBlock>
<TextBox Text="{Binding User.Password, Mode=TwoWay}" />
</StackPanel>
<StackPanel
Grid.Row="1"
Grid.Column="1"
Style="{StaticResource sp}">
<TextBlock>部门:</TextBlock>
<TextBox Text="{Binding User.Department, Mode=TwoWay}" />
</StackPanel>
<StackPanel
Grid.Row="2"
Grid.Column="0"
Style="{StaticResource sp}">
<TextBlock>地址:</TextBlock>
<TextBox Text="{Binding User.Address, Mode=TwoWay}" />
</StackPanel>
<StackPanel
Grid.Row="2"
Grid.Column="1"
Style="{StaticResource sp}">
<TextBlock>电话:</TextBlock>
<TextBox Text="{Binding User.Phone, Mode=TwoWay}" />
</StackPanel>
<StackPanel
Grid.Row="3"
Grid.Column="0"
Style="{StaticResource sp}">
<TextBlock>备注:</TextBlock>
<TextBox Text="{Binding User.Remark, Mode=TwoWay}" />
</StackPanel>
<StackPanel
Grid.Row="3"
Grid.Column="1"
Style="{StaticResource sp}">
<TextBlock>禁用:</TextBlock>
<CheckBox IsChecked="{Binding User.Disable, Mode=TwoWay}" />
</StackPanel>
<GroupBox
Grid.Row="4"
Grid.Column="0"
Grid.ColumnSpan="2"
Width="{Binding ElementName=GridMain, Path=ActualWidth}"
Padding="5"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Header="角色">
<ListView
x:Name="ListViewMain"
ItemsSource="{Binding RoleDtos}"
Style="{x:Null}">
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewColumn
Width="50"
CellTemplate="{StaticResource select}"
Header="选择" />
<GridViewColumn
Width="100"
DisplayMemberBinding="{Binding Id}"
Header="Id" />
<GridViewColumn
Width="100"
DisplayMemberBinding="{Binding RoleName}"
Header="角色名" />
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
</GroupBox>
<StackPanel
Grid.Row="5"
Grid.Column="1"
HorizontalAlignment="Right"
Style="{StaticResource sp}">
<Button
x:Name="BtnSave"
Margin="0,2,10,2"
Click="BtnSave_Click"
IsEnabled="{Binding CanEnable}">
保存
</Button>
<Button
x:Name="BtnCancel"
Margin="0,2,10,2"
Click="BtnCancel_Click">
取消
</Button>
</StackPanel>
</Grid>
</win:BaseWindow>