Sic04/FrameworkLocal/UICore/Accounts/RolePermissionEdit.xaml

127 lines
6.1 KiB
Plaintext
Raw Permalink Normal View History

2022-09-19 09:16:33 +08:00
<Window x:Class="MECF.Framework.UI.Core.Accounts.RolePermissionEdit"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Title="RolePermissionEdit"
Height="700" Width="405"
ShowInTaskbar="False" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
<Window.Resources>
<DataTemplate x:Key="dtCommands">
<ListBox ItemsSource="{Binding}"
HorizontalContentAlignment="Stretch"
Background="Transparent"
Margin="10,3">
<ListBox.ItemTemplate>
<DataTemplate>
<Button Command="{Binding}"
Content="{Binding DisplayName}"
Margin="0 3"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DataTemplate>
<Style TargetType="HeaderedContentControl">
<Setter Property="Margin" Value="4"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="HeaderedContentControl">
<Border Background="YellowGreen"
CornerRadius="5"
Margin="5"
Padding="5"
BorderBrush="Gray"
BorderThickness="2"
>
<DockPanel>
<Border Background="Pink"
CornerRadius="3"
Padding="2"
Margin="3"
BorderBrush="Red"
BorderThickness="3"
DockPanel.Dock="Top"
>
<TextBlock HorizontalAlignment="Center"
Text="{TemplateBinding Header}"/>
</Border>
<ContentPresenter/>
</DockPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<HierarchicalDataTemplate x:Key="dtTreeView" ItemsSource="{Binding Children}">
<Canvas Margin="0">
<CheckBox Canvas.Left="3" Command="{Binding CheckBoxCommand}" CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}}" IsChecked="{Binding IsSelected}" Canvas.Top="8"></CheckBox>
<Label Content="{Binding Name}" Canvas.Left="35" Canvas.Top="0" />
</Canvas>
</HierarchicalDataTemplate>
<Style x:Key="stTreeViewItem" TargetType="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
<!--<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />-->
<Setter Property="FontWeight" Value="Normal" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="FontWeight" Value="Bold" />
</Trigger>
</Style.Triggers>
</Style>
<DataTemplate x:Key="dtNodeInfo">
<WrapPanel>
<WrapPanel.Resources>
<Style TargetType="TextBlock">
<Setter Property="Margin" Value="5 0"></Setter>
</Style>
</WrapPanel.Resources>
<TextBlock Text="当前选择: " />
<TextBlock Text="{Binding SelectedNode.Name,FallbackValue=没有选择任何节点}" />
<TextBlock Text="节点个数: "/>
<TextBlock Text="{Binding Count}"/>
</WrapPanel>
</DataTemplate>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="383*" />
<!--<ColumnDefinition Width="24*" />
<ColumnDefinition Width="96*" />-->
</Grid.ColumnDefinitions>
<Button Margin="251,0,0,20" Content="保存权限" Command="{Binding SavePermissionCommand}" HorizontalAlignment="Left" Width="88" Height="40" VerticalAlignment="Bottom" />
<GroupBox Margin="0,-2,0,76" Header="菜单显示权限" HorizontalAlignment="Left" Width="383">
<TreeView ItemTemplate="{StaticResource dtTreeView}"
ItemsSource="{Binding Path=ChamberAViewModel.Nodes.Children}"
ItemContainerStyle="{StaticResource stTreeViewItem}" />
</GroupBox>
<!--<GroupBox Margin="251,-2,0,76" Header="B腔菜单显示权限" HorizontalAlignment="Left" Width="250">
<TreeView ItemTemplate="{StaticResource dtTreeView}"
ItemsSource="{Binding Path=ChamberBViewModel.Nodes.Children}"
ItemContainerStyle="{StaticResource stTreeViewItem}"/>
</GroupBox>
<GroupBox Margin="500,-3,0,77" Header="C腔菜单显示权限" HorizontalAlignment="Left" Width="250">
<TreeView ItemTemplate="{StaticResource dtTreeView}"
ItemsSource="{Binding Path=ChamberCViewModel.Nodes.Children}"
ItemContainerStyle="{StaticResource stTreeViewItem}"/>
</GroupBox>
<GroupBox Header="D腔菜单显示权限" Margin="750,-2,0,76" HorizontalAlignment="Left" Width="250">
<TreeView ItemTemplate="{StaticResource dtTreeView}" ItemsSource="{Binding Path=ChamberDViewModel.Nodes.Children}" ItemContainerStyle="{StaticResource stTreeViewItem}" />
</GroupBox>-->
<ComboBox Height="24" HorizontalAlignment="Left" SelectionChanged="comboRoles_SelectionChanged" ItemsSource="{Binding Path=RoleNames}" Margin="52,0,0,28" Name="comboRoles" VerticalAlignment="Bottom" Width="172" />
</Grid>
</Window>