RolePermissionEdit.xaml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <Window x:Class="MECF.Framework.UI.Core.Accounts.RolePermissionEdit"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. mc:Ignorable="d"
  7. Title="RolePermissionEdit"
  8. Height="700" Width="405"
  9. ShowInTaskbar="False" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
  10. <Window.Resources>
  11. <DataTemplate x:Key="dtCommands">
  12. <ListBox ItemsSource="{Binding}"
  13. HorizontalContentAlignment="Stretch"
  14. Background="Transparent"
  15. Margin="10,3">
  16. <ListBox.ItemTemplate>
  17. <DataTemplate>
  18. <Button Command="{Binding}"
  19. Content="{Binding DisplayName}"
  20. Margin="0 3"/>
  21. </DataTemplate>
  22. </ListBox.ItemTemplate>
  23. </ListBox>
  24. </DataTemplate>
  25. <Style TargetType="HeaderedContentControl">
  26. <Setter Property="Margin" Value="4"></Setter>
  27. <Setter Property="Template">
  28. <Setter.Value>
  29. <ControlTemplate TargetType="HeaderedContentControl">
  30. <Border Background="YellowGreen"
  31. CornerRadius="5"
  32. Margin="5"
  33. Padding="5"
  34. BorderBrush="Gray"
  35. BorderThickness="2"
  36. >
  37. <DockPanel>
  38. <Border Background="Pink"
  39. CornerRadius="3"
  40. Padding="2"
  41. Margin="3"
  42. BorderBrush="Red"
  43. BorderThickness="3"
  44. DockPanel.Dock="Top"
  45. >
  46. <TextBlock HorizontalAlignment="Center"
  47. Text="{TemplateBinding Header}"/>
  48. </Border>
  49. <ContentPresenter/>
  50. </DockPanel>
  51. </Border>
  52. </ControlTemplate>
  53. </Setter.Value>
  54. </Setter>
  55. </Style>
  56. <HierarchicalDataTemplate x:Key="dtTreeView" ItemsSource="{Binding Children}">
  57. <Canvas Margin="0">
  58. <CheckBox Canvas.Left="3" Command="{Binding CheckBoxCommand}" CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}}" IsChecked="{Binding IsSelected}" Canvas.Top="8"></CheckBox>
  59. <Label Content="{Binding Name}" Canvas.Left="35" Canvas.Top="0" />
  60. </Canvas>
  61. </HierarchicalDataTemplate>
  62. <Style x:Key="stTreeViewItem" TargetType="TreeViewItem">
  63. <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
  64. <!--<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />-->
  65. <Setter Property="FontWeight" Value="Normal" />
  66. <Style.Triggers>
  67. <Trigger Property="IsSelected" Value="True">
  68. <Setter Property="FontWeight" Value="Bold" />
  69. </Trigger>
  70. </Style.Triggers>
  71. </Style>
  72. <DataTemplate x:Key="dtNodeInfo">
  73. <WrapPanel>
  74. <WrapPanel.Resources>
  75. <Style TargetType="TextBlock">
  76. <Setter Property="Margin" Value="5 0"></Setter>
  77. </Style>
  78. </WrapPanel.Resources>
  79. <TextBlock Text="当前选择: " />
  80. <TextBlock Text="{Binding SelectedNode.Name,FallbackValue=没有选择任何节点}" />
  81. <TextBlock Text="节点个数: "/>
  82. <TextBlock Text="{Binding Count}"/>
  83. </WrapPanel>
  84. </DataTemplate>
  85. </Window.Resources>
  86. <Grid>
  87. <Grid.ColumnDefinitions>
  88. <ColumnDefinition Width="383*" />
  89. <!--<ColumnDefinition Width="24*" />
  90. <ColumnDefinition Width="96*" />-->
  91. </Grid.ColumnDefinitions>
  92. <Button Margin="251,0,0,20" Content="保存权限" Command="{Binding SavePermissionCommand}" HorizontalAlignment="Left" Width="88" Height="40" VerticalAlignment="Bottom" />
  93. <GroupBox Margin="0,-2,0,76" Header="菜单显示权限" HorizontalAlignment="Left" Width="383">
  94. <TreeView ItemTemplate="{StaticResource dtTreeView}"
  95. ItemsSource="{Binding Path=ChamberAViewModel.Nodes.Children}"
  96. ItemContainerStyle="{StaticResource stTreeViewItem}" />
  97. </GroupBox>
  98. <!--<GroupBox Margin="251,-2,0,76" Header="B腔菜单显示权限" HorizontalAlignment="Left" Width="250">
  99. <TreeView ItemTemplate="{StaticResource dtTreeView}"
  100. ItemsSource="{Binding Path=ChamberBViewModel.Nodes.Children}"
  101. ItemContainerStyle="{StaticResource stTreeViewItem}"/>
  102. </GroupBox>
  103. <GroupBox Margin="500,-3,0,77" Header="C腔菜单显示权限" HorizontalAlignment="Left" Width="250">
  104. <TreeView ItemTemplate="{StaticResource dtTreeView}"
  105. ItemsSource="{Binding Path=ChamberCViewModel.Nodes.Children}"
  106. ItemContainerStyle="{StaticResource stTreeViewItem}"/>
  107. </GroupBox>
  108. <GroupBox Header="D腔菜单显示权限" Margin="750,-2,0,76" HorizontalAlignment="Left" Width="250">
  109. <TreeView ItemTemplate="{StaticResource dtTreeView}" ItemsSource="{Binding Path=ChamberDViewModel.Nodes.Children}" ItemContainerStyle="{StaticResource stTreeViewItem}" />
  110. </GroupBox>-->
  111. <ComboBox Height="24" HorizontalAlignment="Left" SelectionChanged="comboRoles_SelectionChanged" ItemsSource="{Binding Path=RoleNames}" Margin="52,0,0,28" Name="comboRoles" VerticalAlignment="Bottom" Width="172" />
  112. </Grid>
  113. </Window>