WinPermission.xaml 7.75 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.Entities;assembly=HHECS.Model"
    xmlns:controls="clr-namespace:HHECS.Controls"
    mc:Ignorable="d"
        Title="菜单与权限" Height="424.4" Width="736" 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,0,0,0"/>
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="Margin" Value="23,0,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 Width="3*"></ColumnDefinition>
                <ColumnDefinition Width="5*" ></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>
                    <RowDefinition></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="2*"></ColumnDefinition>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="2*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Row="0" Grid.Column="0" Text="父菜单:" Margin="10,16,0,0" Grid.RowSpan="2" />
                <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="备注:" />
                <StackPanel Grid.Row="5" Grid.Column="0" Grid.RowSpan="2">
                    <TextBlock  TextWrapping="Wrap" Text="创建人:"  />
                    <Label Grid.Column="0" HorizontalAlignment="Center"  Content="{Binding Path=CreatedBy,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" />
                </StackPanel>
                <StackPanel Grid.Row="5" Grid.Column="1" Grid.RowSpan="2">
                    <TextBlock  TextWrapping="Wrap" Text="创建时间:" />
                    <Label HorizontalAlignment="Center"  Content="{Binding Path=Created,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"  VerticalAlignment="Top"/>
                </StackPanel>
                <StackPanel Grid.Row="5" Grid.Column="2" Grid.RowSpan="2">
                    <TextBlock  TextWrapping="Wrap" Text="更新人:"  />
                    <Label  HorizontalAlignment="Center" Content="{Binding Path=LastUpdatedBy,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"  VerticalAlignment="Top"/>
                </StackPanel>
                <StackPanel Grid.Row="5" Grid.Column="3" Grid.RowSpan="2">
                    <TextBlock  TextWrapping="Wrap" Text="更新时间:"/>
                    <Label  HorizontalAlignment="Center" Content="{Binding Path=LastUpdated,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top"/>
                </StackPanel>

                <StackPanel Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Orientation="Horizontal">
                    <Button x:Name="BtnSave" Margin="5" Content="保存" Grid.Column="2" HorizontalAlignment="Left"  Width="75" Click="BtnSave_Click"/>
                    <Button x:Name="BtnCancel" Content="取消" Grid.Column="3" HorizontalAlignment="Left"    Width="75" Click="BtnCancel_Click"/>
                </StackPanel>
                <TextBox x:Name="TxtName" Grid.Row="1" Grid.Column="1" Text="{Binding Path=MenuName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
                <ComboBox x:Name="CBType" Grid.Column="3" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,0,0,0" SelectedValue="{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}"/>
                <TextBlock Grid.Column="2" HorizontalAlignment="Left" Margin="21.6,20.2,0,0" Grid.Row="4" Text="排序:" VerticalAlignment="Top"/>
                <controls:NumericBox x:Name="TxtOrderNum" VerticalAlignment="Center" Width="80" Grid.Row="4" Grid.Column="3" Text="{Binding Path=OrderNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
            </Grid>
        </Grid>
    </DockPanel>
</win:MyWindow>