20230201_145_upperpc/InSituLaboratory/Views/Pages/RoleView.xaml

346 lines
22 KiB
Plaintext
Raw Normal View History

2024-03-11 05:12:02 +00:00
<UserControl x:Class="InSituLaboratory.Views.Pages.RoleView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:InSituLaboratory.Views.Pages"
mc:Ignorable="d"
2024-04-10 09:50:54 +00:00
FontFamily="{StaticResource DigitalDisplay}"
2024-03-11 05:12:02 +00:00
d:DesignHeight="450" d:DesignWidth="800"
Template="{StaticResource PageTempalte}">
<UserControl.Resources>
<ControlTemplate TargetType="ToggleButton" x:Key="ExpandeButtonTemplate">
<Border Background="#409EFE" CornerRadius="3" Width="15" Height="15">
<Path Data="M0 4 8 4M4 0 4 8" Stroke="White" StrokeThickness="1" Name="path"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Data" Value="M0 0 8 0" TargetName="path"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsExpanded}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<Grid Background="Transparent" Name="root" AllowDrop="True">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition MaxWidth="30"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Border Height="1" BorderThickness="0,0,0,1" BorderBrush="#DDD"
HorizontalAlignment="Left" Width="20" VerticalAlignment="Center"
Name="borH"/>
<Grid HorizontalAlignment="Left" VerticalAlignment="Top" Name="canvas" Grid.RowSpan="2">
<Border Width="1" Background="#DDD"
HorizontalAlignment="Left" Name="borV" Height="33"
VerticalAlignment="Top"/>
</Grid>
<Border Grid.ColumnSpan="2" Name="border" Background="Transparent">
<Border.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Color>#09000000</Color>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave">
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Color>Transparent</Color>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Border.Triggers>
<Border Name="header_background">
<ContentPresenter x:Name="PART_Header" ContentSource="Header" Margin="0,3"/>
</Border>
</Border>
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.ColumnSpan="2" Margin="28,0,0,0"/>
</Grid>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding ParentId}" Value="0">
<Setter TargetName="borH" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="borV" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsLastChild}" Value="True">
<Setter TargetName="borV" Property="Height" Value="17"/>
</DataTrigger>
<Trigger Property="IsExpanded" Value="False">
<Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="header_background" Property="Background" Value="#11409EFE">
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="GroupBox">
<Setter Property="Margin" Value="10,5" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<!-- 左上角 -->
<Polyline HorizontalAlignment="Left" VerticalAlignment="Top" Points="0 30, 0 10, 10 0, 30 0" Stroke="#9918AABD" StrokeThickness="1" />
<!-- 左上角点 -->
<Ellipse Width="4" Height="4" Margin="24,-2,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="#9918AABD" />
<Ellipse Width="4" Height="4" Margin="-2,24,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="#9918AABD" />
<!-- 右上角 -->
<Path HorizontalAlignment="Right" VerticalAlignment="Top" Data="M0 0, 3 3, 30 3, 33 0, 68 0, 73 7,78 7, 78 10M8 0, 25 0" Stroke="#5518AABD" />
<!-- 左下角 -->
<Polyline HorizontalAlignment="Left" VerticalAlignment="Bottom" Points="0,0 0,15 10,15" Stroke="#5518AABD" />
<!-- 右下角 -->
<Polyline HorizontalAlignment="Right" VerticalAlignment="Bottom" Points="10,0 0,10" Stroke="#5518AABD" />
<!-- 右下角图标 -->
<Polygon HorizontalAlignment="Right" VerticalAlignment="Bottom" Fill="#9918AABD" Points="0,7 7 7 7 0" />
<Border Margin="30,-0.5,78,0" VerticalAlignment="Top" BorderBrush="#5518AABD" BorderThickness="0,1,0,0" />
<Border Margin="0,10" HorizontalAlignment="Right" BorderBrush="#5518AABD" BorderThickness="0,0,1,0" />
<Border Margin="10,0" VerticalAlignment="Bottom" BorderBrush="#5518AABD" BorderThickness="0,1,0,0" />
<Border Margin="-0.5,15" HorizontalAlignment="Left" BorderBrush="#5518AABD" BorderThickness="0,0,1,0" />
<!-- 箭头 -->
<Path Margin="10,13" HorizontalAlignment="Left" VerticalAlignment="Top" Data="M0 0,3 0,5 4,3 8,0 8,3 4" Fill="#9918AABD" />
<Path Margin="16,13" HorizontalAlignment="Left" VerticalAlignment="Top" Data="M0 0,3 0,5 4,3 8,0 8,3 4" Fill="#5518AABD" />
<!-- 字体 -->
<TextBlock Margin="25,8" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="#18AABD" Text="{TemplateBinding Header}" FontSize="18"/>
<!-- 占位对象 -->
<ContentPresenter />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2024-03-11 05:12:02 +00:00
</UserControl.Resources>
<Border CornerRadius="5" Background="#14273a" Margin="10,5,10,10">
<GroupBox>
<Grid Margin="10,5,10,10" Background="#14273a">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="280"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
2024-03-11 05:12:02 +00:00
<Border Width="1" Grid.Column="1">
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="#DDD" Offset="0.5"/>
<GradientStop Color="Transparent" Offset="1.1"/>
</RadialGradientBrush>
</Border.Background>
</Border>
2024-03-11 05:12:02 +00:00
<!--角色列表-->
<ListBox ItemsSource="{Binding RoleList}" FontSize="15" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Background="#14273a" Margin="5,10" BorderThickness="0" SelectedItem="{Binding CurrentRole}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Grid Background="Transparent">
<Border Height="1" Background="#EEE" VerticalAlignment="Bottom"
Margin="3,1"/>
<Border BorderThickness="3,0,0,0" Name="border" Margin="0,2"
Background="Transparent" CornerRadius="3">
<ContentPresenter/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="gray"/>
<Setter TargetName="border" Property="BorderBrush" Value="gray"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="border" Property="Background" Value="gray"/>
<Setter TargetName="border" Property="BorderBrush" Value="#FE582D"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid TextBlock.Foreground="#666">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="70"/>
</Grid.ColumnDefinitions>
<Border Width="1" Background="#EEE" HorizontalAlignment="Right" Grid.RowSpan="2" Margin="0,10"/>
2024-03-11 05:12:02 +00:00
<TextBlock Text="{Binding RoleName}" FontWeight="Bold" Margin="5,8" Foreground="white"/>
<TextBlock Text="{Binding RoleDesc}" Grid.Row="1" TextTrimming="CharacterEllipsis"
Margin="5,0,5,5" ToolTip="{Binding RoleDesc}"
Foreground="white"/>
2024-03-11 05:12:02 +00:00
<TextBlock Grid.Column="1" Grid.RowSpan="2" Foreground="#409EFE" VerticalAlignment="Center" HorizontalAlignment="Center">
<Hyperlink TextDecorations="None"
Command="{Binding DataContext.ModifyCommand,RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}" Foreground="#E0FFFF">编辑</Hyperlink>
<Hyperlink TextDecorations="None"
Command="{Binding DataContext.DeleteCommand,RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}" Foreground="#E0FFFF">删除</Hyperlink>
</TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
2024-03-11 05:12:02 +00:00
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
2024-03-11 05:12:02 +00:00
<!--选择权限组信息-->
<StackPanel Margin="5,10" DataContext="{Binding CurrentRole}">
<TextBlock Text="{Binding RoleName}" Margin="5" FontWeight="Bold" Foreground="white" FontSize="15"/>
<TextBlock Text="{Binding RoleDesc}" Margin="5,3" Foreground="white" FontSize="14"/>
</StackPanel>
2024-03-11 05:12:02 +00:00
<!--选择用户-->
<Button Content="选择用户" VerticalAlignment="Center" HorizontalAlignment="Right"
Grid.Column="1" Style="{StaticResource NormalButtonStyle}"
Padding="10,0" Margin="5,0" Height="30"
Command="{Binding SelectUserCommand}"/>
2024-03-11 05:12:02 +00:00
<!--菜单选项-->
<Border Background="Gray" Grid.Row="1" Height="26" Margin="5,0" CornerRadius="5,5,0,0" BorderThickness="0,0,0,1" BorderBrush="#409EFE">
<TextBlock Text="菜单选项" VerticalAlignment="Center" Margin="10,0" Foreground="White" FontSize="15"/>
</Border>
2024-03-11 05:12:02 +00:00
<!--用户选项-->
<Border Background="Gray" Grid.Row="1" Grid.Column="1" Height="26" Margin="5,0" CornerRadius="5,5,0,0" BorderThickness="0,0,0,1" BorderBrush="#409EFE">
<TextBlock Text="用户选项" VerticalAlignment="Center" Margin="10,0" Foreground="White" FontSize="15"/>
</Border>
2024-03-11 05:12:02 +00:00
<!--绑定菜单-->
<TreeView ItemsSource="{Binding Menus}" FontSize="15" Grid.Row="2" Margin="5,0,5,10" BorderThickness="0" Background="Transparent">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<Grid Height="26">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" MinWidth="2"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ToggleButton IsChecked="{Binding IsExpanded}"
Margin="3,0" Name="expandBox" Width="15" Height="15"
Template="{StaticResource ExpandeButtonTemplate}"/>
<CheckBox IsChecked="{Binding IsSelected}" Grid.Column="1" Margin="5,0"
HorizontalAlignment="Center" VerticalAlignment="Center"
Command="{Binding DataContext.SelectMenuCommand,RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}">
</CheckBox>
<TextBlock Text="{Binding MenuHeader}" Grid.Column="2" VerticalAlignment="Center" Foreground="White"/>
</Grid>
<HierarchicalDataTemplate.Triggers>
<DataTrigger Binding="{Binding Children.Count}" Value="0">
<Setter TargetName="expandBox" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</HierarchicalDataTemplate.Triggers>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
2024-03-11 05:12:02 +00:00
<!--绑定用户-->
<ListBox ItemsSource="{Binding Users}" Background="#14273a" FontSize="15" Grid.Column="1" Grid.Row="2" Margin="5,3" VerticalAlignment="Top" BorderThickness="0">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="2"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border Background="Transparent" Name="border" Margin="5" CornerRadius="5">
<Grid Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Border CornerRadius="5" Width="30" Height="30" Margin="5,0">
<Border.Background>
<ImageBrush ImageSource="{Binding UserIcon}"/>
</Border.Background>
</Border>
<TextBlock Text="{Binding RealName}" Grid.Column="1" VerticalAlignment="Center" Foreground="White"/>
2024-03-11 05:12:02 +00:00
<Border Width="1" Height="15" Background="#DDD" Grid.Column="1" HorizontalAlignment="Right"/>
2024-03-11 05:12:02 +00:00
<Button Content="&#xe625;" Grid.Column="2" Style="{StaticResource IconButtonStyle}"
Width="24" Height="24" Background="Transparent" Foreground="Wheat"
FontSize="10"
Command="{Binding DataContext.DeleteUserCommand,RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}"/>
</Grid>
</Border>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="gray"/>
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</GroupBox>
</Border>
2024-03-11 05:12:02 +00:00
</UserControl>