305 lines
17 KiB
XML
305 lines
17 KiB
XML
<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"
|
|
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>
|
|
|
|
</UserControl.Resources>
|
|
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="280"/>
|
|
<ColumnDefinition Width="auto"/>
|
|
<ColumnDefinition/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<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>
|
|
|
|
<!--角色列表-->
|
|
<ListBox ItemsSource="{Binding RoleList}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" 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="#F7F9FA"/>
|
|
<Setter TargetName="border" Property="BorderBrush" Value="#F7F9FA"/>
|
|
</Trigger>
|
|
<Trigger Property="IsSelected" Value="True">
|
|
<Setter TargetName="border" Property="Background" Value="#F7F9FA"/>
|
|
<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"/>
|
|
|
|
<TextBlock Text="{Binding RoleName}" FontWeight="Bold" Margin="5,8"/>
|
|
<TextBlock Text="{Binding RoleDesc}" Grid.Row="1" TextTrimming="CharacterEllipsis"
|
|
Margin="5,0,5,5" ToolTip="{Binding RoleDesc}"
|
|
Foreground="#999"/>
|
|
|
|
<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}">编辑</Hyperlink>
|
|
<Hyperlink TextDecorations="None"
|
|
Command="{Binding DataContext.DeleteCommand,RelativeSource={RelativeSource AncestorType=UserControl}}"
|
|
CommandParameter="{Binding}">删除</Hyperlink>
|
|
</TextBlock>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
|
|
<Grid Grid.Column="2">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="auto"/>
|
|
<RowDefinition Height="auto"/>
|
|
<RowDefinition/>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!--选择权限组信息-->
|
|
<StackPanel Margin="5,10" DataContext="{Binding CurrentRole}">
|
|
<TextBlock Text="{Binding RoleName}" Margin="5" FontWeight="Bold" Foreground="#666"/>
|
|
<TextBlock Text="{Binding RoleDesc}" Margin="5,3" Foreground="#999"/>
|
|
</StackPanel>
|
|
|
|
<!--选择用户-->
|
|
<Button Content="选择用户" VerticalAlignment="Center" HorizontalAlignment="Right"
|
|
Grid.Column="1" Style="{StaticResource NormalButtonStyle}"
|
|
Padding="10,0" Margin="5,0" Height="30"
|
|
Command="{Binding SelectUserCommand}"/>
|
|
|
|
<!--菜单选项-->
|
|
<Border Background="#F0F6FB" 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="Gray"/>
|
|
</Border>
|
|
|
|
<!--用户选项-->
|
|
<Border Background="#F0F6FB" 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="Gray"/>
|
|
</Border>
|
|
|
|
<!--绑定菜单-->
|
|
<TreeView ItemsSource="{Binding Menus}" 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"/>
|
|
</Grid>
|
|
<HierarchicalDataTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding Children.Count}" Value="0">
|
|
<Setter TargetName="expandBox" Property="Visibility" Value="Collapsed"/>
|
|
</DataTrigger>
|
|
</HierarchicalDataTemplate.Triggers>
|
|
</HierarchicalDataTemplate>
|
|
</TreeView.ItemTemplate>
|
|
</TreeView>
|
|
|
|
<!--绑定用户-->
|
|
<ListBox ItemsSource="{Binding Users}" 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"/>
|
|
|
|
<Border Width="1" Height="15" Background="#DDD" Grid.Column="1" HorizontalAlignment="Right"/>
|
|
|
|
<Button Content="" Grid.Column="2" Style="{StaticResource IconButtonStyle}"
|
|
Width="24" Height="24" Background="Transparent" Foreground="#666"
|
|
FontSize="8"
|
|
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="#F7F9FA"/>
|
|
</Trigger>
|
|
</DataTemplate.Triggers>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</Grid>
|
|
</Grid>
|
|
</UserControl>
|