|
- <Window x:Class="BPASmartClient.CustomResource.Pages.View.UserConfigView"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
- xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
- Title="UserConfigView" Width="800"
- Height="1000"
- AllowsTransparency="True"
- Background="{x:Null}"
- Topmost="True"
- WindowStartupLocation="CenterScreen"
- WindowStyle="None"
- mc:Ignorable="d">
- <Window.DataContext>
- <vm:UserConfigViewModel/>
- </Window.DataContext>
- <Window.Resources>
- <ImageBrush x:Key="ImageBrushAddBlue" ImageSource="../../Image/按钮/AddGreen.png"></ImageBrush>
- <ImageBrush x:Key="ImageBrushAddGray" ImageSource="../../Image/按钮/Delete.png"></ImageBrush>
- <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
- <Setter Property="SnapsToDevicePixels" Value="True" />
- <Setter Property="OverridesDefaultStyle" Value="true" />
- <Setter Property="IsTabStop" Value="false" />
- <Setter Property="Focusable" Value="false" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type RepeatButton}">
- <Border Background="Transparent" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
- <Setter Property="SnapsToDevicePixels" Value="True" />
- <Setter Property="OverridesDefaultStyle" Value="true" />
- <Setter Property="IsTabStop" Value="false" />
- <Setter Property="Focusable" Value="false" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Thumb}">
- <Border CornerRadius="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
- <Grid>
- <Border CornerRadius="2" Width="0.5" Background="#FF046BFF" />
- <Track x:Name="PART_Track" IsDirectionReversed="true">
- <Track.DecreaseRepeatButton>
- <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
- </Track.DecreaseRepeatButton>
- <Track.Thumb>
- <Thumb Style="{StaticResource ScrollBarThumb}" Margin="4,0,4,0" Background="DodgerBlue"></Thumb>
- </Track.Thumb>
- <Track.IncreaseRepeatButton>
- <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
- </Track.IncreaseRepeatButton>
- </Track>
- </Grid>
- </ControlTemplate>
-
- <ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}">
- <Grid x:Name="Grid" Background="{TemplateBinding Background}">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
- <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
- <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1"
- Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
- Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"
- Template="{StaticResource VerticalScrollBar}"/>
- <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
- </Grid>
- </ControlTemplate>
- <!--对象树子模板-->
- <DataTemplate x:Key="TreeItemTemplate" DataType="TreeViewItem">
- <Grid Margin="50,0,0,0" Height="28">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="30"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock x:Name="tb_PageName" Text="{Binding Name}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0"/>
- <Button x:Name="BtnAdd" Grid.Column="1" Background="Transparent" VerticalAlignment="Center" HorizontalAlignment="Center"
- Command="{Binding DataContext.AddUserPageCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=TreeView}}"
- CommandParameter="{Binding Path=Text,ElementName=tb_PageName}">
- <Button.Template>
- <ControlTemplate TargetType="Button">
- <Grid>
- <Rectangle x:Name="BtnRetangle" Height="20" Width="20" Stroke="Transparent" StrokeThickness="1"
- Fill="{StaticResource ImageBrushAddBlue}"
- VerticalAlignment="Center" HorizontalAlignment="Center">
- </Rectangle>
- <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="BtnRetangle" Property="Height" Value="22"></Setter>
- <Setter TargetName="BtnRetangle" Property="Width" Value="22"></Setter>
- </Trigger>
- <DataTrigger Binding="{Binding IsChecked}" Value="true">
- <Setter TargetName="BtnRetangle" Property="Fill" Value="{StaticResource ImageBrushAddGray}"></Setter>
- <Setter Property="ToolTip" Value="已添加"></Setter>
- </DataTrigger>
- <DataTrigger Binding="{Binding IsChecked}" Value="false">
- <Setter TargetName="BtnRetangle" Property="Fill" Value="{StaticResource ImageBrushAddBlue}"></Setter>
- <Setter Property="ToolTip" Value="添加"></Setter>
- </DataTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </Grid>
- </DataTemplate>
- <Style TargetType="TreeViewItem">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="IsExpanded" Value="True"></Setter>
- <Setter Property="HeaderTemplate">
- <Setter.Value>
- <HierarchicalDataTemplate ItemsSource="{Binding TreeViewItems,Mode=TwoWay}" ItemTemplate="{StaticResource TreeItemTemplate}">
- <StackPanel Orientation="Horizontal" Height="28" VerticalAlignment="Center" HorizontalAlignment="Left">
- <!--Image Source="folder.png" VerticalAlignment="Center" Height="17" Margin="10,0"/>-->
- <TextBlock Text="{Binding Name}" Margin="5,0,0,0" FontSize="15" VerticalAlignment="Center" Foreground="White"/>
- </StackPanel>
- </HierarchicalDataTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type TreeViewItem}">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="SelectionStates">
- <VisualState x:Name="Selected">
- <Storyboard>
- <ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" >
- <EasingColorKeyFrame KeyTime="0" Value="Transparent" />
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
-
- <VisualState x:Name="Unselected" />
- <VisualState x:Name="SelectedInactive">
- <Storyboard>
- <ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
- <EasingColorKeyFrame KeyTime="0" Value="Transparent" />
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- <VisualStateGroup x:Name="ExpansionStates">
- <VisualState x:Name="Expanded">
- <Storyboard>
- <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ItemsHost">
- <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
- </ObjectAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Collapsed" />
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <Border x:Name="Bd" Grid.Column="0" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
- <ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
- </Border>
- <ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Visibility="Collapsed" />
- </Grid>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="HasHeader" Value="false" />
- <Condition Property="Width" Value="Auto" />
- </MultiTrigger.Conditions>
- <Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
- </MultiTrigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="HasHeader" Value="false" />
- <Condition Property="Height" Value="Auto" />
- </MultiTrigger.Conditions>
- <Setter TargetName="PART_Header" Property="MinHeight" Value="19" />
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <Style x:Key="ItemContainer" TargetType="{x:Type ListBoxItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ListBoxItem}">
- <Border x:Name="IconBorder" Background="Transparent" CornerRadius="4" BorderThickness="0">
- <ContentPresenter />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsSelected" Value="true">
- <Setter TargetName="IconBorder" Property="BitmapEffect">
- <Setter.Value>
- <OuterGlowBitmapEffect GlowColor="Transparent" GlowSize="5" />
- </Setter.Value>
- </Setter>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
-
-
-
-
- </Window.Resources>
- <Border Background="Black"
- x:Name="br"
- BorderBrush="#009dff"
- BorderThickness="2">
- <Border.Effect>
- <DropShadowEffect
- BlurRadius="10"
- ShadowDepth="1"
- Color="#009DFF" />
- </Border.Effect>
- <Grid>
- <Image Source="../../Image/权限背景.png" Stretch="Fill"/>
- <Grid Background="Transparent">
- <Grid.RowDefinitions>
- <RowDefinition Height="80"/>
- <RowDefinition Height="50"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="50"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="50"/>
- <RowDefinition Height="10"/>
- </Grid.RowDefinitions>
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
- <TextBlock Text="{Binding UserName}" HorizontalAlignment="Center"
- FontSize="24"
- Foreground="#ddd"/>
- <TextBlock Text="权限分配" Margin="10,0,0,0"
- HorizontalAlignment="Center"
- FontSize="24"
- Foreground="#ddd"/>
- </StackPanel>
- <TextBlock Grid.Row="1"
- Text="页面权限分配" Margin="10,0,0,0"
- HorizontalAlignment="Center" VerticalAlignment="Center"
- FontSize="20"
- Foreground="#ddd"/>
- <TextBlock Grid.Row="3"
- Text="配料权限分配" Margin="10,0,0,0"
- HorizontalAlignment="Center" VerticalAlignment="Center"
- FontSize="20"
- Foreground="#ddd"/>
-
- <Grid Grid.Row="2">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="50"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="100"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="50"/>
- </Grid.ColumnDefinitions>
- <TextBlock Text="权限列表" Width="20"
- TextWrapping="Wrap" Grid.Column="0"
- HorizontalAlignment="Right" VerticalAlignment="Center"
- FontSize="20"
- Foreground="#ddd"/>
- <TextBlock Text="当前用户权限" Width="20"
- Grid.Column="4"
- TextWrapping="Wrap"
- HorizontalAlignment="Left" VerticalAlignment="Center"
- FontSize="20"
- Foreground="#ddd"/>
- <!--#region 页面权限-->
- <ScrollViewer Grid.Column="1" Margin="20,0,0,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True">
- <TreeView x:Name="MyTreeView" ItemsSource="{Binding pageTreeViewModels}"
- ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Transparent" BorderBrush="Transparent"></TreeView>
- </ScrollViewer>
-
-
- <ScrollViewer Grid.Column="3" Margin="10,0,20,0" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True">
- <ListBox x:Name="RightListBox" Grid.Column="3" Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
- ItemsSource="{Binding SelectePage}" >
- <ListBox.Template>
- <ControlTemplate>
- <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
- </ControlTemplate>
- </ListBox.Template>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid Height="28" Margin="10">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="60"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Left" />
- <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
- Command="{Binding DataContext.DeleteUserPageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
- CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
- <Button.Template>
- <ControlTemplate TargetType="Button">
- <Grid>
- <Rectangle x:Name="BtnRetangle" Height="17" Width="17" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
- <Rectangle.Fill>
- <ImageBrush ImageSource="../../Image/按钮/Delete.png"></ImageBrush>
- </Rectangle.Fill>
- </Rectangle>
- <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="BtnRetangle" Property="Height" Value="19"></Setter>
- <Setter TargetName="BtnRetangle" Property="Width" Value="19"></Setter>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </ScrollViewer>
- <StackPanel Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Button Foreground="White" Background="#009DFF"
- FontSize="16" Height="50" Width="70" Margin="10,20"
- Command="{Binding AddAllPageCommand}">
- <TextBlock Text="全部
- 添加" TextWrapping="Wrap"/>
- </Button>
- <Button Foreground="White" Background="#009DFF"
- FontSize="16" Height="50" Width="70" Margin="10,20"
- Command="{Binding DeleteAllPageCommand}">
- <TextBlock Text="全部
- 移除" TextWrapping="Wrap"/>
- </Button>
- </StackPanel>
-
- <!--#endregion-->
- </Grid>
-
- <Grid Grid.Row="4">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="50"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="100"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="50"/>
- </Grid.ColumnDefinitions>
- <TextBlock Text="当前用户权限" Width="20"
- TextWrapping="Wrap"
- HorizontalAlignment="Center" VerticalAlignment="Center"
- FontSize="20"
- Foreground="#ddd"/>
- <TextBlock Text="权限列表" Width="20"
- Grid.Column="4"
- TextWrapping="Wrap"
- HorizontalAlignment="Center" VerticalAlignment="Center"
- FontSize="20"
- Foreground="#ddd"/>
- </Grid>
- <Grid Grid.Row="5">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <Button Content="保存"
- Background="#009DFF"
- Margin="200,5,20,5"
- BorderThickness="0"
- Command="{Binding SaveCommand}"
- FontSize="20"
- Foreground="White"
- TabIndex="3" />
- <Button Content="取消" Grid.Column="1" Background="#009DFF"
- Margin="20,5,200,5"
- BorderThickness="0"
- Command="{Binding CancelCommand}"
- FontSize="20"
- Foreground="White"
- TabIndex="3"/>
- </Grid>
- </Grid>
-
- </Grid>
- </Border>
- </Window>
|