|
- <UserControl x:Class="View.RecipeView"
- 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:View"
- xmlns:vm ="clr-namespace:ViewModel"
- mc:Ignorable="d"
- Name="参数设置界面"
- d:DesignHeight="600" d:DesignWidth="800">
- <UserControl.DataContext>
- <vm:RecipeViewModel/>
- </UserControl.DataContext>
- <UserControl.Resources>
- <ResourceDictionary>
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
- </ResourceDictionary.MergedDictionaries>
- <Style x:Key="button_Style" TargetType="Button">
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="Cursor" Value="Hand" />
- <Setter Property="Foreground" Value="#a2c2e8" />
- <Setter Property="Width" Value="80" />
- <Setter Property="Height" Value="25" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Button">
- <ControlTemplate.Resources>
- <Storyboard x:Key="OnMouseEnter1">
- <ColorAnimationUsingKeyFrames Storyboard.TargetName="BD" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
- <EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF139DDB" />
- </ColorAnimationUsingKeyFrames>
- <ColorAnimationUsingKeyFrames Storyboard.TargetName="BD" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
- <EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF135EC2" />
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </ControlTemplate.Resources>
- <Border
- x:Name="BD"
- Background="Transparent"
- BorderBrush="#05408a"
- BorderThickness="1"
- CornerRadius="12">
- <TextBlock
- x:Name="textBlock"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- FontSize="16"
- Foreground="#a2c2e8"
- Text="{TemplateBinding Content}" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="BD" Property="Background" Value="#009dff" />
- <Setter TargetName="textBlock" Property="Foreground" Value="#a2c2e8" />
- </Trigger>
- <Trigger Property="IsEnabled" Value="False">
- <Setter TargetName="BD" Property="Background" Value="#ff55" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style TargetType="DataGrid">
- <Setter Property="CanUserResizeColumns" Value="false" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="HorizontalGridLinesBrush">
- <Setter.Value>
- <SolidColorBrush Color="#4fade8" />
- </Setter.Value>
- </Setter>
- <Setter Property="VerticalGridLinesBrush">
- <Setter.Value>
- <SolidColorBrush Color="#4fade8" />
- </Setter.Value>
- </Setter>
-
- </Style>
- <!--标题栏样式-->
- <Style TargetType="DataGridColumnHeader">
- <Setter Property="SnapsToDevicePixels" Value="True" />
- <Setter Property="MinWidth" Value="0" />
- <Setter Property="MinHeight" Value="25" />
- <Setter Property="Foreground" Value="#FF00EEF3" />
- <Setter Property="FontSize" Value="16" />
- <Setter Property="Cursor" Value="Hand" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="DataGridColumnHeader">
- <Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1"
- BorderBrush="#FF074B92"
- Width="Auto">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center"
- HorizontalAlignment="Center" />
- <Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"
- Grid.Column="0" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
- VerticalAlignment="Center" RenderTransformOrigin="1,1" />
- <Rectangle Width="1" Fill="#FF074B92" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
- </Grid>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="Height" Value="25" />
- </Style>
- <!--行样式触发-->
- <!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式-->
- <Style TargetType="DataGridRow">
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="Height" Value="30" />
- <Setter Property="Foreground" Value="#a2c2e8" />
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="HorizontalContentAlignment" Value="Center"/>
- </Style>
-
- <!--单元格样式触发-->
- <Style TargetType="DataGridCell">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="DataGridCell">
- <TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Height="30" >
- <ContentPresenter Height="28" />
- </TextBlock>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <Trigger Property="IsSelected" Value="True">
- <Setter Property="Background" Value="#4fade8" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="Foreground" Value="White" />
- </Trigger>
- </Style.Triggers>
- </Style>
-
- </ResourceDictionary>
-
- </UserControl.Resources>
- <Grid >
- <Grid Margin="50" >
- <Grid.RowDefinitions>
- <RowDefinition Height="40"/>
- <RowDefinition Height="40"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="40"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <TextBlock Text="奶茶配方录入" Foreground="Wheat" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
- <StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,0">
- <TextBlock Text="奶茶名称:" Foreground="#409EFF" FontSize="16" Margin="10,0" VerticalAlignment="Center"/>
- <TextBox Text="{Binding LocalGoodName}" Width="120" FontSize="16" Margin="10,0"/>
- <Button Content="添加配方" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding AddRecipeCommand}"/>
- <Button Content="保存" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding SaveRecipeCommand}"/>
- <Button Content="取消" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding RecipeCancelCommand}"/>
- </StackPanel>
- <DataGrid Grid.Row="2" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding materialRecipes}"
- x:Name="recipeDataGrid"
- FrozenColumnCount="1"
- VerticalAlignment="Top"
- IsReadOnly="True"
- CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
- CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" >
- <DataGrid.Columns >
- <DataGridTemplateColumn Header="ID" Width="30">
- <DataGridTemplateColumn.CellTemplate >
- <DataTemplate>
- <TextBlock Text="{ Binding MaterialID}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="配料" Width="*">
- <DataGridTemplateColumn.CellTemplate >
- <DataTemplate>
- <ComboBox x:Name="combox" FontSize="16" Width="100"
- ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MaterailList}"
- IsReadOnly="True"
-
- SelectedValue="{Binding Material ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
- />
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="配料量" Width="175">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" >
- <TextBox Text="{Binding MaterialWeight}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" FontSize="16"/>
- <TextBlock Text="g" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16"/>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
-
- <DataGridTemplateColumn Header="操作" Width="*">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
- <Button Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RemoveRecipeCommand}"
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}"
- Style="{StaticResource button_Style}"/>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </DataGrid>
-
- <TextBlock Text="本地奶茶配方" Grid.Row="3" Foreground="Wheat" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
- <DataGrid Grid.Row="4" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding localMaterialRecipes}" Width="500"
- FrozenColumnCount="1"
- VerticalAlignment="Top"
- IsReadOnly="True"
- CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
- CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
- <DataGrid.Columns>
- <DataGridTemplateColumn Header="奶茶" Width="200">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" >
- <TextBlock Text="{Binding RecipeName}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16"/>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="操作" Width="*">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
- <Button Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteRecipeCommand}"
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}"
- Style="{StaticResource button_Style}"/>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </DataGrid>
- </Grid>
-
- <Grid >
- <Grid.RowDefinitions>
- <RowDefinition Height="40"/>
- <RowDefinition Height="40"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="40"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <TextBlock Text="配料名称修改" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Wheat" FontSize="18"/>
- <Button Content="更新物料位置名称" Grid.Column="2" Grid.Row="1" Style="{StaticResource button_Style}" Width="150" Command="{Binding UpdateMaterialPosionCommand}"/>
- <DataGrid Grid.Row="2" Grid.RowSpan="3" Grid.Column="2" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding materailNameAndPosions}"
- FrozenColumnCount="1"
- VerticalAlignment="Top"
- IsReadOnly="True"
- CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
- CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
- <DataGrid.Columns>
- <DataGridTemplateColumn Header="物料位置" Width="170">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" >
- <TextBlock Text="{Binding MaterialPosion}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" FontSize="16"/>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="物料" Width="*">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalContentAlignment="Center" Width="80" FontSize="16"/>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </DataGrid>
-
- </Grid>
- </Grid>
-
- </UserControl>
|