|
- <UserControl x:Class="BPASmart.RecipeManagement.View.RecipeManager"
- 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">
- <UserControl.DataContext>
- <vm:RecipeManagerViewModel/>
- </UserControl.DataContext>
- <UserControl.Resources>
- <Style TargetType="ListViewItem" >
- <Setter Property="Margin" Value="10"/>
-
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ListViewItem">
- <Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="1,5" CornerRadius="10" Margin="10"
- Background="#104E8B">
- <Grid
- Name="tt"
- Height="200"
- Width="150"
- Margin="5">
- <Grid.RowDefinitions>
- <RowDefinition Height="30" />
- <RowDefinition Height="20" />
- <RowDefinition Height="128" />
- <RowDefinition Height="2" />
- <RowDefinition Height="40" />
- </Grid.RowDefinitions>
- <TextBlock
- Grid.Row="0"
- Margin="2,5,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Top"
- FontSize="18"
- Foreground="Orange"
- Text="{Binding Name}" />
-
- <TextBlock
- Grid.Row="1"
- Margin="5,0,0,0"
- VerticalAlignment="Top"
- Foreground="White"
- Text="配方信息:" />
-
- <ScrollViewer
- Grid.Row="2"
- VerticalAlignment="Top"
- Background="Transparent"
- HorizontalScrollBarVisibility="Hidden"
- VerticalScrollBarVisibility="Hidden">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="auto" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
-
- <ItemsControl ItemsSource="{Binding recipeMaterials}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Grid>
- <TextBlock
- Grid.Row="1"
- Margin="5,0,0,0"
- HorizontalAlignment="Right"
- VerticalAlignment="Center"
- Foreground="#FF2AB2E7"
- Text="{Binding Name}" />
- </Grid>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
-
- <ItemsControl Grid.Column="1"
- VerticalAlignment="Center"
- VerticalContentAlignment="Center" ItemsSource="{Binding recipeMaterials}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal">
-
- <TextBlock
- Margin="5,0,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="#FF2AB2E7"
- Text=":" />
-
- <TextBlock
- Margin="5,0,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="#FF2AB2E7"
- Text="{Binding MaterialWeight}" />
-
- <TextBlock
- Margin="5,0,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="#FF2AB2E7"
- Text="g" />
-
- </StackPanel>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
-
- </Grid>
-
- </ScrollViewer>
-
- <Button Grid.Row="4" Content="配方工艺" Style="{DynamicResource ButtonStyle}"
- Height="20" Width="80" HorizontalAlignment="Right" VerticalAlignment="Top"
- Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor},Path=DataContext.PecipeSettingCommand}"
- CommandParameter="{Binding ID}"/>
- </Grid>
-
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="BorderBrush" Value="#CD8500" TargetName="mborder"/>
-
- </Trigger>
- <Trigger Property="IsFocused" Value="True">
-
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- </UserControl.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="40"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <TextBlock Text="配方清单" FontSize="28" VerticalAlignment="Center" HorizontalAlignment="Center"/>
- <ListView Grid.Row="1"
- ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding RecipeList}" Margin=" 10" Background="Transparent" >
- <ListView.ContextMenu>
- <ContextMenu FontSize="16" Foreground="White">
- <MenuItem Header="新建配方" Name="MenuAdd" Command="{Binding CreateRecipeCommand}"></MenuItem>
- <MenuItem Header="编辑配方" Name="MenuEdit"
- Command="{Binding EditRecipeCommand }"
- CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem>
- <MenuItem Header="删除配方" Name="MenuDelete"
- Command="{Binding DeleteRecipeCommand}"
- CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem>
- </ContextMenu>
- </ListView.ContextMenu>
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Margin="10"/>
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- </ListView>
- </Grid>
- </UserControl>
|