|
- <UserControl x:Class="BPASmart.RecipeManagement.View.MaterialManager"
- 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" >
- <UserControl.DataContext>
- <vm:MaterialManagerViewModel/>
- </UserControl.DataContext>
- <UserControl.Resources>
-
- <Style TargetType="ListViewItem" >
- <Setter Property="Margin" Value="60,20"/>
-
- <Setter Property="Template">
-
- <Setter.Value>
- <ControlTemplate TargetType="ListViewItem">
- <Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="1,5" CornerRadius="10">
-
- <Grid Width="100" >
- <Grid.Background>
- <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
- <GradientStop Color="#4F94CD" Offset="0"/>
- <GradientStop Color="Transparent" Offset="0.3"/>
- <GradientStop Color="Transparent" Offset="0.7"/>
- <GradientStop Color="#4F94CD" Offset="1" />
- </LinearGradientBrush>
- </Grid.Background>
- <Grid.RowDefinitions>
- <RowDefinition Height="60"/>
- <RowDefinition Height="25"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <TextBlock Text="{Binding MaterialPosion}" Height="20" Width="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,0"/>
- <TextBlock Text="{Binding Name}" Grid.ColumnSpan="2"
- FontSize="24"
- HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
- <TextBlock Grid.Row="1" Text="种类:" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"/>
- <TextBlock Grid.Row="1" Grid.Column="1" FontSize="16"
- VerticalAlignment="Center" HorizontalAlignment="Left"
- Text="{Binding MaterialType}" TextAlignment="Center"></TextBlock>
-
-
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="BorderBrush" Value="#D2B48C" TargetName="mborder"/>
-
- </Trigger>
- <Trigger Property="IsFocused" Value="True">
-
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <Style TargetType="{x:Type ContextMenu}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ContextMenu}">
- <Border x:Name="Border" CornerRadius="4" Background="#009ACD" BorderThickness="1" Margin="0">
- <Border.BorderBrush>
- <SolidColorBrush Color="#104E8B" />
- </Border.BorderBrush>
- <ItemsPresenter/>
- </Border>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsMouseOver" Value="True"/>
- </MultiTrigger.Conditions>
- <MultiTrigger.EnterActions>
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)">
- <SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
- <SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="110"/>
- </DoubleAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)">
- <SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/>
- <SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/>
- </DoubleAnimationUsingKeyFrames>
- </Storyboard>
- </BeginStoryboard>
- </MultiTrigger.EnterActions>
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style TargetType="{x:Type MenuItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type MenuItem}">
- <Border Margin="0,5" MinWidth="80" CornerRadius="5">
- <Border.Background>
- <SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" />
- </Border.Background>
- <StackPanel Orientation="Horizontal">
- <TextBlock Text=" "/>
- <ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" />
- <TextBlock Text=" "/>
- <ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </StackPanel>
- </Border>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsMouseOver" Value="True"/>
- </MultiTrigger.Conditions>
- <MultiTrigger.EnterActions>
- <BeginStoryboard>
- <Storyboard>
- <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
- <LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0020000" />
- <LinearColorKeyFrame Value="#B0E2FF" KeyTime="00:00:00.0320000" />
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </BeginStoryboard>
- </MultiTrigger.EnterActions>
- <MultiTrigger.ExitActions>
- <BeginStoryboard>
- <Storyboard>
- <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color">
- <LinearColorKeyFrame Value="#7E9C9C9C" KeyTime="00:00:00.0020000" />
- <LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0320000" />
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </BeginStoryboard>
- </MultiTrigger.ExitActions>
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </UserControl.Resources>
- <Grid Background="White">
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="*"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <Grid Grid.RowSpan="2">
- <Grid.RowDefinitions>
- <RowDefinition Height="40"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <TextBlock Text="原料清单" FontSize="28" Foreground="DarkSlateGray" VerticalAlignment="Center" HorizontalAlignment="Center"/>
- <ListView x:Name="mylistview" Grid.Row="1"
- ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding MaterialList}" Margin=" 10" Background="#FFFAFA" >
- <ListView.ContextMenu>
- <ContextMenu FontSize="16" Foreground="White">
- <MenuItem Header="新建原料" Name="MenuAdd" Command="{Binding CreateMaterailCommand}"></MenuItem>
- <MenuItem Header="编辑原料" Name="MenuEdit"
- Command="{Binding EditMaterailCommand }"
- CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem>
- <MenuItem Header="删除原料" Name="MenuDelete"
- Command="{Binding DeleteMaterailCommand}"
- CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem>
- </ContextMenu>
- </ListView.ContextMenu>
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Margin="10"/>
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
-
- <!--<ContextMenu>
- <ContextMenu FontSize="16" Foreground="White">
- <MenuItem Header="新建原料" Name="MenuCreate"
- Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.CreateMaterailCommand}"></MenuItem>
- <MenuItem Header="编辑原料" Name="MenuEdit"
- Command="{Binding RelativeSource={RelativeSource Mode= FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.EditMaterailCommand}"
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListView}},Path=SelectedItem}"></MenuItem>
- <MenuItem Header="删除原料" Name="MenuDelete"
- Command="{Binding RelativeSource={RelativeSource Mode= FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteMaterailCommand}"
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListView}},Path=SelectedItem}"></MenuItem>
- </ContextMenu>
- </ContextMenu>-->
-
- </ListView>
- </Grid>
- </Grid>
- </UserControl>
|