RoleView.xaml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <UserControl x:Class="Venus_MainPages.Views.RoleView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:Venus_MainPages.Views"
  7. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  8. xmlns:prism="http://prismlibrary.com/"
  9. xmlns:customControls="clr-namespace:Venus_Themes.CustomControls;assembly=Venus_Themes"
  10. prism:ViewModelLocator.AutoWireViewModel="True"
  11. mc:Ignorable="d"
  12. d:DesignHeight="450" d:DesignWidth="800">
  13. <!--<Grid>
  14. <Grid.RowDefinitions>
  15. <RowDefinition Height="40"/>
  16. <RowDefinition/>
  17. </Grid.RowDefinitions>
  18. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
  19. <customControls:PathButton Width="120" Height="30" Content="Add"/>
  20. <customControls:PathButton Width="120" Height="30" Content="Delete"/>
  21. <customControls:PathButton Width="120" Height="30" Content="Edit"/>
  22. </StackPanel>
  23. <DataGrid Grid.Row="1" ItemsSource="{Binding Menus}" AlternationCount="2"
  24. Width="500" FontSize="20"
  25. AutoGenerateColumns="False" HorizontalAlignment="Center" VerticalAlignment="Top" CanUserAddRows="False" Margin="0">
  26. <DataGrid.Columns>
  27. <DataGridTemplateColumn Header="Id" Width="60">
  28. <DataGridTemplateColumn.CellTemplate>
  29. <DataTemplate>
  30. <TextBlock Text="{Binding Id}"/>
  31. </DataTemplate>
  32. </DataGridTemplateColumn.CellTemplate>
  33. </DataGridTemplateColumn>
  34. <DataGridTemplateColumn Header="FirstMenu" Width="200">
  35. <DataGridTemplateColumn.CellTemplate>
  36. <DataTemplate>
  37. <TextBlock Text="{Binding FirstMenu}"/>
  38. </DataTemplate>
  39. </DataGridTemplateColumn.CellTemplate>
  40. </DataGridTemplateColumn>
  41. <DataGridTemplateColumn Header="SecondMenu" Width="200" >
  42. <DataGridTemplateColumn.CellTemplate>
  43. <DataTemplate>
  44. <TextBlock Text="{Binding SecondMenu}"/>
  45. </DataTemplate>
  46. </DataGridTemplateColumn.CellTemplate>
  47. </DataGridTemplateColumn>
  48. </DataGrid.Columns>
  49. <DataGrid.GroupStyle>
  50. <GroupStyle >
  51. <GroupStyle.ContainerStyle>
  52. <Style TargetType="{x:Type GroupItem}">
  53. <Setter Property="Template">
  54. <Setter.Value>
  55. <ControlTemplate TargetType="{x:Type GroupItem}">
  56. <Expander IsExpanded="False" Style="{StaticResource ExpanderStyle}" ExpandDirection="Down" SnapsToDevicePixels="True" VerticalAlignment="Top">
  57. <Expander.Header>
  58. <StackPanel Orientation="Horizontal">
  59. <TextBlock Text="{Binding Name}" Width="120"/>
  60. <TextBlock Text=" Count:"/>
  61. <TextBlock Text="{Binding ItemCount}"/>
  62. </StackPanel>
  63. </Expander.Header>
  64. <ItemsPresenter/>
  65. </Expander>
  66. </ControlTemplate>
  67. </Setter.Value>
  68. </Setter>
  69. </Style>
  70. </GroupStyle.ContainerStyle>
  71. </GroupStyle>
  72. </DataGrid.GroupStyle>
  73. <DataGrid.RowStyle>
  74. <Style TargetType="{x:Type DataGridRow}">
  75. <Style.Triggers>
  76. <Trigger Property="ItemsControl.AlternationIndex"
  77. Value="0">
  78. <Setter Property="Background" Value="#EAEAEA" />
  79. </Trigger>
  80. <Trigger Property="ItemsControl.AlternationIndex"
  81. Value="1">
  82. <Setter Property="Background" Value="#CDCDC1" />
  83. </Trigger>
  84. </Style.Triggers>
  85. </Style>
  86. </DataGrid.RowStyle>
  87. </DataGrid>
  88. </Grid>-->
  89. <Canvas>
  90. <TreeView Name="checkView" Grid.Column="0" Margin="0,50,0,0" ItemsSource="{Binding VenusMenus}" Width="Auto">
  91. <TreeView.ItemTemplate>
  92. <HierarchicalDataTemplate ItemsSource="{Binding MenuItem,Mode=OneTime}">
  93. <StackPanel Orientation="Horizontal">
  94. <CheckBox IsChecked="{Binding Path=IsShow}">
  95. <i:Interaction.Triggers>
  96. <i:EventTrigger EventName="Checked">
  97. <i:InvokeCommandAction Command="{Binding Path=DataContext.MenuItem,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=TreeViewItem}}" CommandParameter="{Binding}"/>
  98. </i:EventTrigger>
  99. </i:Interaction.Triggers>
  100. </CheckBox>
  101. <TextBlock Foreground="White" FontSize="15" Text="{Binding Path=Id}" HorizontalAlignment="Center" />
  102. </StackPanel>
  103. </HierarchicalDataTemplate>
  104. </TreeView.ItemTemplate>
  105. </TreeView>
  106. <Button Content="Save" Command="{Binding SaveCommand}" Grid.Row="1" Width="100" Height="20" HorizontalAlignment="Left"/>
  107. </Canvas>
  108. </UserControl>