WinRoleAddOrEdit.xaml
4.34 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
<win:BaseWindow
x:Class="HHECS.WinClient.View.UserPermission.WinRoleAddOrEdit"
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:dtos="clr-namespace:HHECS.Model.Dtos;assembly=HHECS.Model"
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="390"
Height="500"
d:DataContext="{d:DesignInstance Type=local:RoleAddOrEditVM}"
mc:Ignorable="d">
<Window.Resources>
<Style x:Key="sp" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="10,5" />
</Style>
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Width" Value="300" />
</Style>
<Style
x:Key="btn"
BasedOn="{StaticResource BaseButtonStyle}"
TargetType="Button">
<Setter Property="Margin" Value="2" />
</Style>
</Window.Resources>
<Grid x:Name="GridMain">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Style="{StaticResource sp}">
<TextBlock Text="角色名:" />
<TextBox x:Name="TxtName" Text="{Binding Role.RoleName}" />
</StackPanel>
<StackPanel Grid.Row="1" Style="{StaticResource sp}">
<TextBlock Text="备注:" />
<TextBox x:Name="TxtRemark" Text="{Binding Role.Remark}" />
</StackPanel>
<TreeView
x:Name="treeMain"
Grid.Row="2"
ItemsSource="{Binding TreePermissionDtos}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type dtos:PermissionDto}" ItemsSource="{Binding Path=Childrens}">
<StackPanel Orientation="Horizontal">
<CheckBox
Margin="2"
Click="CheckBox_Click"
IsChecked="{Binding HasPerm, Mode=TwoWay}"
Tag="{Binding Id}" />
<Image
Width="16"
Height="16"
Margin="0,0,2,2"
VerticalAlignment="Center"
Source="{Binding Icon}" />
<TextBlock Text="{Binding PermissionName}" />
<!--<Image VerticalAlignment="Center" Source="{Binding EditIcon}" Margin="2,0,0,0"></Image>-->
<StackPanel.ToolTip>
<TextBlock
MaxWidth="200"
Text="{Binding Remark}"
TextWrapping="Wrap" />
</StackPanel.ToolTip>
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<StackPanel
Grid.Row="3"
HorizontalAlignment="Right"
Style="{StaticResource sp}">
<Button
x:Name="BtnQuery"
Click="BtnQuery_Click"
Content="刷新"
Style="{StaticResource btn}" />
<Button
x:Name="BtnSave"
Click="BtnSave_Click"
Content="保存"
IsEnabled="{Binding SaveEnable}"
Style="{StaticResource btn}" />
<Button
x:Name="BtnCancel"
Click="BtnCancel_Click"
Content="取消"
Style="{StaticResource btn}" />
</StackPanel>
</Grid>
</win:BaseWindow>