<UserControl x:Class="XHandler.View.User.EditAuthority"
|
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:XHandler.View.User"
|
xmlns:str="clr-namespace:XHandler.Properties"
|
xmlns:cls ="clr-namespace:XHandler.Class"
|
mc:Ignorable="d"
|
d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
|
<UserControl.Resources>
|
<Style TargetType="{x:Type RadioButton}">
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
<Setter Property="Background" Value="White"/>
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
<Setter Property="BorderThickness" Value="0"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="{x:Type RadioButton}">
|
<Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="*"/>
|
</Grid.ColumnDefinitions>
|
<Ellipse x:Name="outerElipse" Width="20" Height="20" StrokeThickness="1" Stroke="#FF616467" Fill="White" Margin="0"
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<Ellipse x:Name="innerElipse" Width="6" Height="6" StrokeThickness="0" Fill="White" Margin="0" Opacity="0"
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}"
|
Grid.Column="1" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False"
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="5,0,0,0"
|
RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
</Grid>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsMouseOver" Value="True">
|
<Setter Property="Opacity" TargetName="outerElipse" Value="0.8"/>
|
</Trigger>
|
<Trigger Property="IsEnabled" Value="False">
|
<Setter Property="Fill" TargetName="outerElipse" Value="#FFE6E6E6"/>
|
</Trigger>
|
<!--<Trigger Property="IsPressed" Value="True">
|
<Setter Property="Background" TargetName="outerElipse" Value="#20FFFFFF"/>
|
</Trigger>-->
|
<Trigger Property="IsChecked" Value="True">
|
<Setter Property="Fill" TargetName="outerElipse" Value="{DynamicResource blueBrush}"/>
|
<Setter Property="Opacity" TargetName="innerElipse" Value="1"/>
|
<Setter Property="StrokeThickness" TargetName="outerElipse" Value="0"/>
|
</Trigger>
|
<Trigger Property="IsChecked" Value="{x:Null}">
|
<Setter Property="Opacity" TargetName="innerElipse" Value="0"/>
|
<Setter Property="StrokeThickness" TargetName="outerElipse" Value="1"/>
|
<Setter Property="Fill" TargetName="outerElipse" Value="white"/>
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
|
<Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
|
<Setter Property="Focusable" Value="False"/>
|
<Setter Property="Width" Value="16"/>
|
<Setter Property="Height" Value="16"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
<Border Background="Transparent" Height="16" Padding="5,5,5,5" Width="16">
|
<Path x:Name="ExpandPath" Data="{StaticResource TreeArrow}" Fill="Transparent" Stroke="#FF989898">
|
<Path.RenderTransform>
|
<RotateTransform Angle="135" CenterY="3" CenterX="3"/>
|
</Path.RenderTransform>
|
</Path>
|
</Border>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsMouseOver" Value="True">
|
<Setter Property="Stroke" TargetName="ExpandPath" Value="#FF1BBBFA"/>
|
<Setter Property="Fill" TargetName="ExpandPath" Value="Transparent"/>
|
</Trigger>
|
<Trigger Property="IsChecked" Value="True">
|
<Setter Property="RenderTransform" TargetName="ExpandPath">
|
<Setter.Value>
|
<RotateTransform Angle="180" CenterY="3" CenterX="3"/>
|
</Setter.Value>
|
</Setter>
|
<Setter Property="Fill" TargetName="ExpandPath" Value="#FF595959"/>
|
<Setter Property="Stroke" TargetName="ExpandPath" Value="#FF262626"/>
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<Style x:Key="treeViewItemStyle" TargetType="{x:Type TreeViewItem}">
|
<Setter Property="Background" Value="Transparent"/>
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
<Setter Property="Padding" Value="1,0,0,0"/>
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded}"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="{x:Type TreeViewItem}">
|
<Grid>
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition MinWidth="16" Width="Auto"/>
|
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="Auto"/>
|
</Grid.ColumnDefinitions>
|
<Grid.RowDefinitions>
|
<RowDefinition Height="30"/>
|
<RowDefinition/>
|
</Grid.RowDefinitions>
|
<Border x:Name="BdBack" Margin="1" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" CornerRadius="3" Background="Transparent"></Border>
|
<ToggleButton x:Name="Expander" Grid.Row="0" Grid.Column="0" Style="{StaticResource ExpandCollapseToggleStyle}" ClickMode="Press" IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"/>
|
<Border x:Name="Bd" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" CornerRadius="3" SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" x:Name="PART_Header" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header"/>
|
</Border>
|
<ItemsPresenter x:Name="ItemsHost" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2"/>
|
</Grid>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsExpanded" Value="false">
|
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
|
</Trigger>
|
<Trigger Property="HasItems" Value="false">
|
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
|
</Trigger>
|
<Trigger Property="IsSelected" Value="true">
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource listSelectedBrush}"/>
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}"/>
|
</Trigger>
|
<!--<MultiTrigger>
|
<MultiTrigger.Conditions>
|
<Condition Property="IsSelected" Value="true"/>
|
<Condition Property="IsSelectionActive" Value="false"/>
|
</MultiTrigger.Conditions>
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource lightBlueBrush}"/>
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}}"/>
|
</MultiTrigger>-->
|
<Trigger Property="IsEnabled" Value="false">
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
|
</Trigger>
|
<MultiTrigger>
|
<MultiTrigger.Conditions>
|
<Condition Property="IsMouseOver" Value="true" SourceName="Bd"/>
|
<Condition Property="IsSelected" Value="false"/>
|
</MultiTrigger.Conditions>
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource lightBlueBrush}"/>
|
<!--<Setter Property="BorderBrush" TargetName="BdBack" Value="{DynamicResource lightBlueBrush}" />-->
|
</MultiTrigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
<!--<EventSetter Event="PreviewMouseRightButtonDown" Handler="TreeViewItem_PreviewMouseRightButtonDown"/>-->
|
</Style>
|
|
<HierarchicalDataTemplate x:Key="MyTreeItemTemplate"
|
DataType="{x:Type cls:MenuTree}"
|
ItemsSource="{Binding Path=Children,Mode=OneWay}">
|
<StackPanel x:Name="My_SP" Orientation="Horizontal" Margin="2" VerticalAlignment="Center">
|
<CheckBox IsChecked="{Binding Path=IsChecked}" FontSize="16"/>
|
<!--<ContentPresenter Content="{Binding Path=Name,Mode=OneTime}" Margin="2,0"/>-->
|
<TextBlock Foreground="Black" FontSize="16" Text="{Binding Name}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" />
|
</StackPanel>
|
</HierarchicalDataTemplate>
|
|
<Style TargetType="{x:Type CheckBox}">
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
<Setter Property="Background" Value="White"/>
|
<Setter Property="BorderBrush" Value="#FF616467"/>
|
<Setter Property="FontSize" Value="16"/>
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
<Setter Property="BorderThickness" Value="1"/>
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="{x:Type CheckBox}">
|
<Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="*"/>
|
</Grid.ColumnDefinitions>
|
<Border x:Name="checkBoxBorder" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
Width="20" Height="20" BorderBrush="#FF616467" BorderThickness="1" CornerRadius="5">
|
<Grid x:Name="markGrid">
|
<!--<Rectangle x:Name="line1" Fill="#FF19939D" Opacity="0" Height="2" Width="{TemplateBinding Width}" VerticalAlignment="Top"/>
|
<Rectangle x:Name="line2" Fill="#FF19939D" Opacity="0" Height="{TemplateBinding Height}" Width="2" HorizontalAlignment="Left"/>-->
|
<!--<Path x:Name="optionMark" Data="F1M17,5L9,16 2,10 5,8 8,11 15,2 z" Fill="White" Margin="4" Opacity="0" Stretch="Uniform"/>-->
|
<Path x:Name="optionMark" Data="M5,5 L15,18 L38,0" Stroke="White" StrokeThickness="2" Margin="4" Opacity="0" Stretch="Uniform"/>
|
<Rectangle x:Name="indeterminateMark" Fill="#FF0E81EC" Opacity="1" Margin="3"/>
|
</Grid>
|
</Border>
|
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}"
|
Grid.Column="1" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False"
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="5,0,0,0"
|
RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
</Grid>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsChecked" Value="True">
|
<Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="Transparent"/>
|
<Setter Property="Background" TargetName="checkBoxBorder" Value="#FF0E81EC"/>
|
<Setter Property="Opacity" TargetName="optionMark" Value="1"/>
|
<Setter Property="Opacity" TargetName="indeterminateMark" Value="0"/>
|
</Trigger>
|
<Trigger Property="IsChecked" Value="False">
|
<Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="#FFC6CBD0"/>
|
<Setter Property="Opacity" TargetName="optionMark" Value="0"/>
|
<Setter Property="Opacity" TargetName="indeterminateMark" Value="0"/>
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
</UserControl.Resources>
|
|
<Grid x:Name="root" Background="#01FFFFFF" PreviewMouseDown="root_PreviewMouseDown">
|
<Border x:Name="border" Width="0" Visibility="Collapsed" HorizontalAlignment="Right" Background="White" BorderBrush="LightGray"
|
BorderThickness="1">
|
<Grid>
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="100"/>
|
<ColumnDefinition Width="*"/>
|
</Grid.ColumnDefinitions>
|
<Grid.RowDefinitions>
|
<RowDefinition Height="50"/>
|
<RowDefinition Height="20"/>
|
<RowDefinition Height="40"/>
|
<RowDefinition Height="40"/>
|
<RowDefinition Height="100"/>
|
<RowDefinition Height="40"/>
|
<RowDefinition Height="*"/>
|
<RowDefinition Height="60"/>
|
</Grid.RowDefinitions>
|
|
<Grid Grid.Row="0" Grid.ColumnSpan="2">
|
<TextBlock x:Name="title" Text="角色编辑" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20 0" FontSize="20"
|
Foreground="Black" FontWeight="Bold"/>
|
<Button Content="×" HorizontalAlignment="Right" VerticalAlignment="Center" VerticalContentAlignment="Center" Margin="10 0" FontSize="28" Width="40" Height="40"
|
FontWeight="Bold" Foreground="Black" Style="{DynamicResource BlueButtonStyle}" Background="White" Click="Button_Click" BorderThickness="0"/>
|
<Rectangle Height="1" Fill="Gray" VerticalAlignment="Bottom" Margin="15 0"/>
|
</Grid>
|
|
<TextBlock Grid.Row="2" Grid.Column="0" Text="角色名" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
<TextBlock x:Name="textboxRoleName" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch" Text="{Binding Name}"
|
VerticalAlignment="Center" FontSize="16" Margin="20 0 100 0" FontWeight="Bold"/>
|
|
|
<TextBlock Grid.Row="3" Grid.Column="0" Text="角色状态" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
<ComboBox x:Name="comboxStatus" Grid.Row="3" Grid.Column="1" Height="35" VerticalContentAlignment="Center" FontSize="16"
|
Background="White" IsEditable="False" Margin="20 0 100 0" SelectionChanged="comboxStatus_SelectionChanged"/>
|
|
<TextBlock Grid.Row="4" Grid.Column="0" Text="角色描述" FontSize="16" VerticalAlignment="Top" HorizontalAlignment="Right"
|
Margin="0 15"/>
|
<TextBox x:Name="textboxRemark" Grid.Row="4" Grid.Column="1" Height="80" VerticalContentAlignment="Top" HorizontalAlignment="Stretch"
|
VerticalAlignment="Center" FontSize="16" Margin="20 0 100 0" Text="{Binding Remarks}"/>
|
|
<TextBlock Grid.Row="5" Grid.Column="0" Text="数据权限" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"
|
/>
|
<StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="1" Margin="20 0 100 0">
|
<RadioButton x:Name="radioBtnSelf" Content="只查看本人数据" FontSize="16"
|
VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 0 15 0" Checked="radioBtnSelf_Checked"/>
|
<RadioButton x:Name="radioBtnAll" Content="查看全部数据" FontSize="16"
|
VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 0 15 0" Checked="radioBtnAll_Checked"/>
|
</StackPanel>
|
|
<TextBlock Grid.Row="6" Grid.Column="0" Text="操作权限" FontSize="16" VerticalAlignment="Top" HorizontalAlignment="Right"
|
Margin="0 15"/>
|
<TreeView Grid.Row="6" Grid.Column="1" x:Name="tv" ItemContainerStyle="{StaticResource treeViewItemStyle}" Margin="20 10 100 0"
|
ItemTemplate="{StaticResource MyTreeItemTemplate}" BorderThickness="0">
|
</TreeView>
|
|
|
<Button Content="取消" x:Name="btnCancel" Grid.Row="7" Grid.Column="1" HorizontalAlignment="Right"
|
Foreground="Black" Style="{DynamicResource BlueButtonStyle}" Background="White" BorderThickness="1" BorderBrush="Black"
|
Height="40" Width="100" Click="btnCancel_Click" FontSize="16" Margin="0 0 150 0" Visibility="Collapsed"/>
|
|
<Button Content="保存" x:Name="btnSave" Grid.Row="7" Grid.Column="1" HorizontalAlignment="Right"
|
Foreground="White" Style="{DynamicResource BlueButtonStyle}" Background="{DynamicResource blueBrush}" BorderThickness="0"
|
Height="40" Width="100" Click="btnSave_Click" FontSize="16" Margin="0 0 20 0"/>
|
|
</Grid>
|
</Border>
|
</Grid>
|
</UserControl>
|