|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411 |
- <UserControl x:Class="BPASmart.RecipeManagement.View.PowerManager"
- 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:BPASmart.RecipeManagement.View"
- xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel"
- mc:Ignorable="d"
- d:DesignHeight="450" d:DesignWidth="800" Foreground="#FF2AB2E7" FontFamily="楷体">
- <UserControl.DataContext>
- <vm:PowerManagerViewModel/>
- </UserControl.DataContext>
- <UserControl.Resources>
- <ImageBrush x:Key="powerback" ImageSource="../Image/边框元素1.png"/>
- <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="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>
-
- <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>
- </UserControl.Resources>
- <Border>
- <Border.Background>
- <ImageBrush ImageSource="../image/背景.png"/>
- </Border.Background>
-
- <Grid Margin="0,10">
- <Grid.RowDefinitions>
- <RowDefinition Height="40"/>
- <RowDefinition Height="20"/>
- <RowDefinition Height="40"/>
- <RowDefinition />
- </Grid.RowDefinitions>
-
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
- <TextBlock Text="选择用户" FontSize="22" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="20,0"/>
- <ComboBox Width="120" Margin="20,0" ItemsSource="{Binding UserName }" FontSize="16" Foreground="#FF2AB2E7"/>
- <Button Style="{DynamicResource ButtonStyle}" Margin="20,0" Content="保 存"
- FontSize="18" Height="30" Width="120"
- Command="{Binding SaveCommand}" CommandParameter="Materials">
- </Button>
-
- </StackPanel>
-
- <Grid Grid.Row="2">
- <Grid.ColumnDefinitions>
- <ColumnDefinition/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <Border Width="150">
- <Border.Background>
- <ImageBrush ImageSource="../Image/元素1.png"/>
- </Border.Background>
- <TextBlock Text="原料权限" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5" />
- </Border>
- <Border Width="150" Grid.Column="1">
- <Border.Background>
- <ImageBrush ImageSource="../Image/元素1.png"/>
- </Border.Background>
- <TextBlock Text="配方权限" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5" />
- </Border>
-
-
- </Grid>
- <Grid Grid.Row="3" Margin="5,10,5,50">
- <Grid.ColumnDefinitions>
- <ColumnDefinition/>
- <ColumnDefinition Width="80"/>
- <ColumnDefinition/>
- <ColumnDefinition Width="20"/>
- <ColumnDefinition/>
- <ColumnDefinition Width="80"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <!--#region原料权限-->
- <Border Grid.Column="0" Margin="10,0,10,0" CornerRadius="5" Background="{DynamicResource powerback}" >
-
- <ScrollViewer Margin="20,42" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"
- Width="auto">
- <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
- ItemsSource="{Binding AllMaterials}" >
- <ListBox.Template>
- <ControlTemplate>
- <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
- </ControlTemplate>
- </ListBox.Template>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid Height="28" Margin="5">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="60"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" />
- <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
- Command="{Binding DataContext.AddMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
- CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
- <Button.Template>
- <ControlTemplate TargetType="Button">
- <Grid>
- <Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
- <Rectangle.Fill>
- <ImageBrush ImageSource="../Image/AddGreen.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="24"></Setter>
- <Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </ScrollViewer>
- </Border>
-
- <StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" >
-
- <Button
- FontSize="14" Height="30" Width="100" Margin="0,20" VerticalAlignment="Center" HorizontalAlignment="Center"
- Command="{Binding AddAllCommand}" CommandParameter="Materials" Style="{DynamicResource GreenButton}" >
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="auto"/>
- <ColumnDefinition Width="auto"/>
- </Grid.ColumnDefinitions>
- <Image Source="../Image/增加.png" Width="15" Margin="2"/>
- <TextBlock Grid.Column="1" Text="全部添加" HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </Grid>
- </Button>
-
- <Button Style="{DynamicResource DeleteButton}" VerticalAlignment="Center" HorizontalAlignment="Center"
- FontSize="18" Height="30" Width="100" Margin="0,20"
- Command="{Binding DeleteAllCommand}" CommandParameter="Materials">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="auto"/>
- <ColumnDefinition Width="auto"/>
- </Grid.ColumnDefinitions>
- <Image Source="../Image/移除.png" Width="15" Margin="2"/>
- <TextBlock Grid.Column="1" Text="全部移除" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" />
-
- </Grid>
-
- </Button>
- </StackPanel>
- <Border Grid.Column="2" Background="{DynamicResource powerback}" Margin="10,0,10,0">
-
- <ScrollViewer Grid.Column="2" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" Margin="20,42">
- <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" Width="auto"
-
- ItemsSource="{Binding UserMaterials}" >
- <ListBox.Template>
- <ControlTemplate>
- <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
- </ControlTemplate>
- </ListBox.Template>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid Height="28" Margin="5">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="60"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" />
- <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
- Command="{Binding DataContext.DeleteMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
- CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
- <Button.Template>
- <ControlTemplate TargetType="Button">
- <Grid>
- <Rectangle x:Name="BtnRetangle" Height="21" Width="21" 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="24"></Setter>
- <Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </ScrollViewer>
- </Border>
- <!--#endregion-->
- <!--#region 配方权限-->
-
- <Border Grid.Column="4" Background="{DynamicResource powerback}" Margin="10,0,10,0">
- <ScrollViewer Margin="20,42" Grid.Column="4" Width="auto" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" >
- <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
- ItemsSource="{Binding AllRecipes}" >
- <ListBox.Template>
- <ControlTemplate>
- <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
- </ControlTemplate>
- </ListBox.Template>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid Height="28" Margin="5">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="60"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" />
- <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
- Command="{Binding DataContext.AddRecipeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
- CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
- <Button.Template>
- <ControlTemplate TargetType="Button">
- <Grid>
- <Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
- <Rectangle.Fill>
- <ImageBrush ImageSource="../Image/AddGreen.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="24"></Setter>
- <Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </ScrollViewer>
- </Border>
- <StackPanel Grid.Column="5" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Button Style="{DynamicResource GreenButton}" HorizontalAlignment="Center" VerticalAlignment="Center"
- FontSize="18" Height="30" Width="80" Margin="0,20"
- Command="{Binding AddAllCommand}" CommandParameter="Recipes">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="auto"/>
- <ColumnDefinition Width="auto"/>
- </Grid.ColumnDefinitions>
- <Image Source="../Image/增加.png" Width="15" Margin="2"/>
- <TextBlock Grid.Column="1" Text="全部添加" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </Grid>
- </Button>
- <Button Style="{DynamicResource DeleteButton}" HorizontalAlignment="Center" VerticalAlignment="Center"
- FontSize="18" Height="30" Width="80" Margin="0,20"
- Command="{Binding DeleteAllCommand}" CommandParameter="Recipes">
-
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="auto"/>
- <ColumnDefinition Width="auto"/>
- </Grid.ColumnDefinitions>
- <Image Source="../Image/移除.png" Width="15" Margin="2"/>
- <TextBlock Grid.Column="1" Text="全部移除" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" />
- </Grid>
- </Button>
- </StackPanel>
-
- <Border Grid.Column="6" Background="{DynamicResource powerback}" Margin="10,0,10,0">
- <ScrollViewer Grid.Column="6" Margin="20,42" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True">
- <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
- Width="auto"
- ItemsSource="{Binding UserRecipes}" >
- <ListBox.Template>
- <ControlTemplate>
- <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
- </ControlTemplate>
- </ListBox.Template>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid Height="28" Margin="5">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="60"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" />
- <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
- Command="{Binding DataContext.DeleteRecipeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
- CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
- <Button.Template>
- <ControlTemplate TargetType="Button">
- <Grid>
- <Rectangle x:Name="BtnRetangle" Height="21" Width="21" 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="24"></Setter>
- <Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Button.Template>
- </Button>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </ScrollViewer>
- </Border>
-
- <!--#endregion-->
-
-
- </Grid>
- </Grid>
- </Border>
- </UserControl>
|