alielie
2025-03-26 4cac1b533e133fdc8b3def90a0f998820f51907a
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
<pu:WindowX x:Class="HMI.MenuManage.RoleModal"
            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: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}" 
              Header="{DynamicResource HMI.Role.Code}"
                          dp:FormGroupHelper.IsRequired="True"
                          dp:FormGroupHelper.ValidateMethod="ValidateCode"
                          GroupName="MyFormGroup">
                <TextBox x:Name="TbCode" Style="{StaticResource EditorTextBoxStyle}" />
            </pu:FormGroup>
 
            <pu:FormGroup x:Name="FgName" Style="{StaticResource InputFormGroupStyle}" 
                              Header="{DynamicResource HMI.Role.Name}"
            dp:FormGroupHelper.IsRequired="True" GroupName="MyFormGroup">
                <TextBox x:Name="TbName" Style="{StaticResource EditorTextBoxStyle}" />
            </pu:FormGroup>
            
            <pu:FormGroup x:Name="FgMenu" Orientation="Vertical" Style="{StaticResource RequiredInputFormGroupStyle}" 
                              Header="{DynamicResource HMI.Role.Permission}" GroupName="MyFormGroup">
                <TreeView x:Name="menuTree" Grid.Column="1" Style="{StaticResource DefaultTreeView}" 
                          ItemsSource="{Binding TreeDataSource}">
                    <TreeView.ItemTemplate>
                        <HierarchicalDataTemplate ItemsSource="{Binding Children}">
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                <CheckBox VerticalAlignment="Center" IsChecked="{Binding Selected}"
Command="{Binding CheckCommand}"
CommandParameter="{Binding Path=IsChecked,RelativeSource={RelativeSource Mode=Self}}"/>
                                <Image Width="{StaticResource ContentFontSize}" 
                                       Height="{StaticResource ContentFontSize}" Margin="5" Source="{Binding MenuIcon,Converter={StaticResource path2Image},Mode=OneWay}"/>
                                <TextBlock VerticalAlignment="Center" Text="{Binding MenuName}"/>
                            </StackPanel>
                        </HierarchicalDataTemplate>
                    </TreeView.ItemTemplate>
                </TreeView>
            </pu:FormGroup>
        </StackPanel>
    </Grid>
</pu:WindowX>