WinPermission.xaml 7.24 KB
<win:MyWindow
    xmlns:win="clr-namespace:HHECS.View.Win" x:Class="HHECS.View.UserOperation.WinPermission"
        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:HHECS.View.UserOperation"
        xmlns:model="clr-namespace:HHECS.Model;assembly=HHECS.Model"
        mc:Ignorable="d"
        Title="菜单与权限" Height="450" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize">
    <Window.Resources>
        <Style TargetType="TextBox">
            <Setter Property="Width" Value="80"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="TextWrapping" Value="Wrap"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="Margin" Value="9.4,20,0,0"/>
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="Margin" Value="23,20,0,0"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="TextWrapping" Value="Wrap"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
        </Style>
    </Window.Resources>
    <DockPanel>
        <ToolBar DockPanel.Dock="Top">
            <Button x:Name="BtnNew" Click="Button_Click">新增</Button>
            <Button x:Name="BtnDelete" Click="BtnDelete_Click">删除</Button>
            <!--<Button x:Name="BtnEdit" Click="BtnEdit_Click">编辑</Button>-->
            <Button x:Name="BtnUpdate" Click="BtnUpdate_Click" Content="刷新"/>
        </ToolBar>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition ></ColumnDefinition>
                <ColumnDefinition ></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <TreeView x:Name="treeMain" Grid.Column="0" TreeViewItem.Selected="treeMain_Selected">
                <TreeView.ItemTemplate>
                    <HierarchicalDataTemplate DataType="{x:Type model:MenuOperation}" ItemsSource="{Binding Path=Children}">
                        <StackPanel Orientation="Horizontal">
                            <Image VerticalAlignment="Center" Source="{Binding Icon}" Width="16" Height="16" Margin="0,0,2,2"></Image>
                            <TextBlock VerticalAlignment="Center" Text="{Binding MenuName}"></TextBlock>
                            <Image VerticalAlignment="Center" Source="{Binding EditIcon}" Margin="2,0,0,0"></Image>
                            <StackPanel.ToolTip>
                                <TextBlock VerticalAlignment="Center" Text="{Binding Remark}" TextWrapping="Wrap" MaxWidth="200" ></TextBlock>
                            </StackPanel.ToolTip>
                        </StackPanel>
                    </HierarchicalDataTemplate>
                </TreeView.ItemTemplate>
            </TreeView>
            <GridSplitter  Width="5"/>
            <Grid x:Name="GridDetail" Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="0" Grid.Column="0" Text="父菜单:" />
                <Label Grid.Column="1" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{Binding Path=ParentId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
                <TextBlock Grid.Row="1" TextWrapping="Wrap" Text="名称:" />
                <TextBlock Grid.Row="1" Grid.Column="2" TextWrapping="Wrap" Text="类型:" />
                <TextBlock Grid.Row="2" TextWrapping="Wrap" Text="地址:" />
                <TextBlock Grid.Row="3" TextWrapping="Wrap" Text="权限:" />
                <TextBlock Grid.Row="4" TextWrapping="Wrap" Text="备注:" />
                <TextBlock Grid.Row="5" Grid.Column="0" TextWrapping="Wrap" Text="创建人:" Margin="23,7.4,0,0" />
                <TextBlock Grid.Row="5" Grid.Column="1" TextWrapping="Wrap" Text="创建时间:" Margin="22.8,7.4,0,0" />
                <TextBlock Grid.Row="5" Grid.Column="2" TextWrapping="Wrap" Text="更新人:" Margin="23.6,7.4,0,0" />
                <TextBlock Grid.Row="5" Grid.Column="3" TextWrapping="Wrap" Text="更新时间:" Margin="14.4,7.4,0,0" />


                <Button x:Name="BtnSave" Content="保存" Grid.Column="2" HorizontalAlignment="Left" Margin="9.6,12.4,0,10.4" Grid.Row="6"  Width="75" Click="BtnSave_Click"/>
                <Button x:Name="BtnCancel" Content="取消" Grid.Column="3" HorizontalAlignment="Left" Margin="14.4,12.4,0,10.4" Grid.Row="6"  Width="75" Click="BtnCancel_Click"/>

                <TextBox x:Name="TxtName" Grid.Row="1" Grid.Column="1" Text="{Binding Path=MenuName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
                <TextBox x:Name="TxtType" Grid.Column="3" Grid.Row="1" Text="{Binding Path=MenuType,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
                <TextBox x:Name="TxtUrl" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Width="280" Text="{Binding Path=Url,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
                <TextBox x:Name="TxtPermission" Grid.Row="3" Grid.Column="1" Text="{Binding Path=Perms,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                <TextBox x:Name="TxtRemark" Grid.Row="4" Grid.Column="1"  Text="{Binding Path=Remark,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
                <Label Grid.Column="0" HorizontalAlignment="Left" Margin="23,31.4,0,0" Grid.Row="5"  Content="{Binding Path=CreatedBy,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" />
                <Label Grid.Column="1" HorizontalAlignment="Left" Margin="22.8,31.4,0,0" Grid.Row="5" Content="{Binding Path=Created,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"  VerticalAlignment="Top"/>
                <Label Grid.Column="2" HorizontalAlignment="Left" Margin="21.6,33.4,0,0" Grid.Row="5" Content="{Binding Path=LastUpdatedBy,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"  VerticalAlignment="Top"/>
                <Label Grid.Column="3" HorizontalAlignment="Left" Margin="14.4,32.4,0,0" Grid.Row="5" Content="{Binding Path=LastUpdated,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top"/>
                <TextBlock Grid.Column="2" HorizontalAlignment="Left" Margin="21.6,20.2,0,0" Grid.Row="4" Text="排序" VerticalAlignment="Top"/>
                <TextBox x:Name="TxtOrderNum" Grid.Row="4" Grid.Column="3" Text="{Binding Path=OrderNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
            </Grid>
        </Grid>
    </DockPanel>
</win:MyWindow>