|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <UserControl x:Class="BPASmartClient.MilkWithTea.View.LocalConfigureView"
- 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:BPASmartClient.MilkWithTea.View"
- xmlns:vm="clr-namespace:BPASmartClient.MilkWithTea.ViewModel"
- mc:Ignorable="d"
- d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent">
- <UserControl.DataContext>
- <vm:LocalConfigureViewModel/>
- </UserControl.DataContext>
- <UserControl.Resources>
- <Style TargetType="{x:Type DataGridCell}">
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="TextBlock.FontSize" Value="13" />
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="BorderBrush" Value="Transparent"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content.Text}" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type DataGridCell}">
- <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
- <!--HorizontalAlignment 可以设置内容展示位置-->
- <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" HorizontalAlignment="Center"
- Margin="{TemplateBinding Padding}"/>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Opacity" Value=".56"/>
- </Trigger>
- </Style.Triggers>
- </Style>
- <Style TargetType="DataGridRow">
- <Setter Property="FontSize" Value="16"/>
- <Setter Property="VerticalAlignment" Value="Center"/>
- <Setter Property="Margin" Value="0,5"/>
- <Style.Triggers>
- <!-- 隔行换色 -->
- <Trigger Property="AlternationIndex" Value="0">
- <Setter Property="Background" Value="#FFFAFAFA" />
- </Trigger>
- <Trigger Property="AlternationIndex" Value="1">
- <Setter Property="Background" Value="#FFF5F5F7" />
- </Trigger>
-
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="Background" Value="#87CEFA" />
- </Trigger>
- </Style.Triggers>
- </Style>
- <Style TargetType="Button">
- <Setter Property="Width" Value="90"/>
- <Setter Property="Height" Value="20"/>
- <Setter Property="Foreground" Value="White"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="Background" Value="#43a9c7"/>
- <Setter Property="FontSize" Value="16"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Button">
- <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
- <TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="border" Property="Background" Value="#2f96b4"/>
- </Trigger>
- <Trigger Property="IsPressed" Value="True">
- <Setter TargetName="border" Property="Background" Value="#2a89a4"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </UserControl.Resources>
- <Grid Background="#F3F6F9" Margin="20">
- <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
- <StackPanel>
- <!--奶茶配方录入-->
- <Expander Style="{StaticResource ExpanderStyle}">
- <Expander.Header>
- <TextBlock Text="奶茶配方录入" />
- </Expander.Header>
- <Expander.Content>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="80"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <StackPanel Orientation="Horizontal" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,0">
- <TextBlock Text="奶茶名称:" Foreground="DarkSlateGray" FontSize="20" Margin="10,0" VerticalAlignment="Center" />
- <TextBox Text="{Binding LocalGoodName}" Width="120" FontSize="16" Margin="10,0" VerticalContentAlignment="Center" Padding="2"/>
- <Button Content="添加配方" Margin="10,0" Width="120" Command="{Binding AddRecipeCommand}" Style="{StaticResource buttonNormal}"/>
- <Button Content="保存" Margin="10,0" Width="80" Command="{Binding SaveRecipeCommand}" Style="{StaticResource buttonNormal}"/>
- <Button Content="清空" Margin="10,0" Width="80" Command="{Binding RecipeCancelCommand}" Style="{StaticResource buttonNormal}"/>
- </StackPanel>
- <DataGrid Grid.Row="1" Margin="100,5,100,20" AutoGenerateColumns="False" RowHeight="32" ItemsSource="{Binding materialRecipes}"
- x:Name="recipeDataGrid"
- FrozenColumnCount="1"
- VerticalAlignment="Center" HorizontalAlignment="Center"
- Background="#F3F6F9"
- IsReadOnly="True"
- CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
- CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" >
- <DataGrid.Columns >
- <DataGridTemplateColumn Header="ID" Width="40">
- <DataGridTemplateColumn.CellTemplate >
- <DataTemplate>
- <TextBlock Text="{ Binding MaterialID}" Foreground="Black"
- VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5"/>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="配料" Width="200">
- <DataGridTemplateColumn.CellTemplate >
- <DataTemplate>
- <ComboBox x:Name="combox" FontSize="16" Width="100" VerticalContentAlignment="Top"
- ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MaterailList}"
- IsReadOnly="True" Style="{StaticResource cmbstyle}" Height="30"
- SelectedIndex="1"
- SelectedValue="{Binding Material ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="配料量" Width="175" >
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" Margin="3" >
- <TextBox Text="{Binding MaterialWeight}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" FontSize="16"/>
- <TextBlock Text="g" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16" Foreground="Black"/>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
-
- <DataGridTemplateColumn Header="操作" Width="300">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
- <Button Margin="4"
- Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RemoveRecipeCommand}"
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" />
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </DataGrid>
- </Grid>
- </Expander.Content>
- </Expander>
- <!--配料录入-->
- <Expander Grid.Row="1" Style="{StaticResource ExpanderStyle}">
- <Expander.Header>
- <TextBlock Text="本地配料录入" />
- </Expander.Header>
- <Expander.Content>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="70"/>
- <RowDefinition Height="*"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <Button Content="保存物料位置名称" Grid.ColumnSpan="2" Style="{StaticResource buttonNormal}" Height="34" Width="200" Command="{Binding UpdateMaterialPosionCommand}"/>
- <DataGrid Grid.Row="1" Margin="50,5" AutoGenerateColumns="False" ItemsSource="{Binding materail1,Mode=TwoWay}"
- FrozenColumnCount="1" RowHeight="34"
- VerticalAlignment="Top" HorizontalAlignment="Right"
- 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 Foreground="Black" Text="{Binding MaterialPosion}"
- VerticalAlignment="Center" HorizontalAlignment="Left"
- Margin="5,0" FontSize="16"/>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="物料" Width="250">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
- VerticalAlignment="Center" HorizontalContentAlignment="Center"
- VerticalContentAlignment="Center"
- Margin="2" FontSize="16"
- Width="160" Height="28" />
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </DataGrid>
- <DataGrid Grid.Row="1" Grid.Column="1" Margin="50,5" AutoGenerateColumns="False" ItemsSource="{Binding materail2,Mode=TwoWay}"
- FrozenColumnCount="1" RowHeight="34"
- VerticalAlignment="Top" HorizontalAlignment="Left"
- 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 Foreground="Black" Text="{Binding MaterialPosion}"
- VerticalAlignment="Center" HorizontalAlignment="Left"
- Margin="5,0" FontSize="16"/>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="物料" Width="250">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
- VerticalAlignment="Center" HorizontalContentAlignment="Center"
- VerticalContentAlignment="Center"
- Margin="2" Height="28"
- Width="160" FontSize="16"/>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </DataGrid>
- </Grid>
- </Expander.Content>
- </Expander>
- <!--奶茶清单-->
- <Expander Grid.Row="2" Style="{StaticResource ExpanderStyle}" >
- <Expander.Header>
- <TextBlock Text="本地奶茶配方"/>
- </Expander.Header>
- <Expander.Content>
- <DataGrid Grid.Row="4" Margin="100,5" AutoGenerateColumns="False" RowHeight="32" 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 GoodNames}" Foreground="Black"
- VerticalAlignment="Center" HorizontalAlignment="Center"
- Margin="5,2" FontSize="16"/>
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- <DataGridTemplateColumn Header="操作" Width="*">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
- <Button Content="删除" Margin="2"
- Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteRecipeCommand}"
- CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" />
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </DataGrid>
- </Expander.Content>
- </Expander>
- </StackPanel>
- </ScrollViewer>
- </Grid>
- </UserControl>
|