wenxiangchao
3 天以前 b544d5cccd76735e034c8055918a50927b437474
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
<pu:WindowX x:Class="HMI.MenuManage.UserModal"
            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:HMI.MenuManage"
            xmlns:pw="https://opensource.panuon.com/wpf"
            xmlns:pu="https://opensource.panuon.com/wpf-ui"
            xmlns:uic="clr-namespace:HMI.UI.Converter;assembly=HMI.UI"
            xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI"
            mc:Ignorable="d"
            Title="Form"
            SizeToContent="Height"
            Width="600"
            WindowStartupLocation="CenterOwner"
            Style="{StaticResource ModalWindow}">
    <Grid Margin="10">
        <StackPanel x:Name="formPanel">
            <pu:FormGroup x:Name="FgCode" Style="{StaticResource InputFormGroupStyle}"
                          dp:FormGroupHelper.ValidateMethod="ValidateCode"
              Header="{DynamicResource HMI.User.Code}"
              dp:FormGroupHelper.IsRequired="True" GroupName="MyFormGroup">
                <TextBox x:Name="TbCode" Style="{StaticResource EditorTextBoxStyle}" />
            </pu:FormGroup>
 
            <pu:FormGroup x:Name="FgName" Style="{StaticResource InputFormGroupStyle}" 
                          Header="{DynamicResource HMI.User.RealName}"
                          dp:FormGroupHelper.IsRequired="True" GroupName="MyFormGroup">
                <TextBox x:Name="TbName" Style="{StaticResource EditorTextBoxStyle}" />
            </pu:FormGroup>
 
            <pu:FormGroup x:Name="FgUsername" Style="{StaticResource InputFormGroupStyle}"
                         dp:FormGroupHelper.ValidateMethod="ValidateUsername"
                         Header="{DynamicResource HMI.User.Account}" 
                         dp:FormGroupHelper.IsRequired="True" GroupName="MyFormGroup">
                <TextBox x:Name="TbUsername" Style="{StaticResource EditorTextBoxStyle}" />
            </pu:FormGroup>
 
            <pu:FormGroup x:Name="FgPassword" Style="{StaticResource InputFormGroupStyle}"
                          Header="{DynamicResource HMI.User.Password}" 
                          dp:FormGroupHelper.IsRequired="True" GroupName="MyFormGroup">
                <PasswordBox x:Name="TbPassword" pu:PasswordBoxHelper.PlainButtonVisibility="VisibleOnHover"
                             Style="{StaticResource SignInPasswordBoxStyle}" />
            </pu:FormGroup>
 
            <pu:FormGroup x:Name="FgRoleCode" Orientation="Vertical"
                          Style="{StaticResource InputFormGroupStyle}"
                          Header="{DynamicResource HMI.Role}" GroupName="MyFormGroup">
                <DataGrid x:Name="table" Style="{StaticResource DefaultDataGrid}" SelectionMode="Single" 
           ItemsSource="{Binding Roles}">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Width="Auto" CanUserResize="False">
                            <DataGridTemplateColumn.Header>
                                <TextBlock Text="{DynamicResource App.Granted}"/>
                            </DataGridTemplateColumn.Header>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <CheckBox VerticalAlignment="Center" 
                               HorizontalAlignment="Center" IsChecked="{Binding Selected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
 
                        <DataGridTextColumn Header="#"
             Binding="{Binding Converter={StaticResource rowNumber},
                     RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow},AncestorLevel=1}}"
                             CanUserResize="False"/>
                        <DataGridTextColumn Width="*" Binding="{Binding RoleCode}">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{DynamicResource HMI.Role.Code}"/>
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                        <DataGridTextColumn Width="*" Binding="{Binding RoleName}">
                            <DataGridTextColumn.Header>
                                <TextBlock Text="{DynamicResource HMI.Role.Name}"/>
                            </DataGridTextColumn.Header>
                        </DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </pu:FormGroup>
        </StackPanel>
    </Grid>
</pu:WindowX>