C00225155-02/C00225155/MegaRobo.C00225155/MegaRobo.C00225155App/res/BoxDataTemplate.xaml

191 lines
9.0 KiB
Plaintext
Raw Normal View History

2026-04-13 09:12:49 +00:00
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MegaRobo.C00224159App"
xmlns:models="clr-namespace:Common.Models;assembly=Common"
xmlns:common="clr-namespace:Common;assembly=Common"
xmlns:views="clr-namespace:MegaRobo.C00225155App.MenuViews">
<!-- 样品工装模板3行4列网格 -->
<DataTemplate x:Key="SampleBoxTemplate" DataType="{x:Type models:SampleBottleBoxModel}">
<Grid Margin="20,10">
<TextBlock Text="{Binding BoxId_inDosingStation, FallbackValue=-, TargetNullValue=-}"
FontSize="60"
FontWeight="Bold"
Foreground="Gray"
Opacity="0.3"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
TextAlignment="Center"/>
<!-- 3行4列样品瓶网格 -->
<ItemsControl Grid.Row="1" ItemsSource="{Binding SampleBottleList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="3" Columns="4" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type models:SampleBottleModel}">
<views:SampleBottleUserControl SampleBottleModel="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</DataTemplate>
<!-- 原液工装模板2行4列网格 -->
<DataTemplate x:Key="SourceLiquidBoxTemplate" DataType="{x:Type models:SourceLiquidBottleBoxModel}">
<Grid Margin="20,8">
<!--<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
-->
<TextBlock Text="{Binding BoxId_inDosingStation, FallbackValue=-, TargetNullValue=-}"
FontSize="60"
FontWeight="Bold"
Foreground="Gray"
Opacity="0.3"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
TextAlignment="Center"/>
<!-- 2行4列原液瓶网格 -->
<ItemsControl Grid.Row="1" ItemsSource="{Binding SourceLiquidBottleCollection}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="2" Columns="4" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type models:SourceLiquidBottleModel}">
<views:LiquidBottleUserControl LiquidBottleModel="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</DataTemplate>
<!--16ml粉末工装模板 1行 4列-->
<DataTemplate x:Key="powderBoxTemplate_16ml" DataType="{x:Type models:SourcePowderBottleBoxModel}">
<Grid Margin="20,8">
<TextBlock Text="{Binding BoxId_inDoseUpload, FallbackValue=-, TargetNullValue=-}"
FontSize="60"
FontWeight="Bold"
Foreground="Gray"
Opacity="0.3"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
TextAlignment="Center"/>
<!-- 1行4列粉末瓶网格 -->
<ItemsControl Grid.Row="1" ItemsSource="{Binding SourcePowderBottleCollection}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1" Columns="4" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type models:SourcePowderBottleModel}">
<views:PowderBottleUserControl PowderBottleModel="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</DataTemplate>
<!--125ml粉末工装模板 1行 2列-->
<DataTemplate x:Key="powderBoxTemplate_125ml" DataType="{x:Type models:SourcePowderBottleBoxModel}">
<Grid Margin="20,8">
<TextBlock Text="{Binding BoxId_inDoseUpload, FallbackValue=-, TargetNullValue=-}"
FontSize="60"
FontWeight="Bold"
Foreground="Gray"
Opacity="0.3"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
TextAlignment="Center"/>
<!-- 1行4列粉末瓶网格 -->
<ItemsControl Grid.Row="1" ItemsSource="{Binding SourcePowderBottleCollection}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1" Columns="2" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type models:SourcePowderBottleModel}">
<views:PowderBottleUserControl PowderBottleModel="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</DataTemplate>
<DataTemplate x:Key="TipHeaderBoxTemplate" DataType="{x:Type models:TipBoxModel}">
<Grid Margin="20,8">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Grid.RowSpan="2" Text="{Binding BoxId_inDosingStation, FallbackValue=-, TargetNullValue=-}"
FontSize="40"
FontWeight="Bold"
Foreground="Gray"
Opacity="0.3"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
TextAlignment="Center"/>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<TextBlock Text="Tip类型" FontSize="15" Margin="5"/>
<ComboBox Width="110" Height="25" ItemsSource="{x:Static common:EnumHelper.TipHeadTypeEnums}" SelectedItem="{Binding TipType,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
<ItemsControl Grid.Row="1" ItemsSource="{Binding TipItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="8" Columns="12" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Width="10" Height="10" BorderBrush="Black" BorderThickness="1" CornerRadius="5">
<Border.Style>
<Style TargetType="Border">
<!-- 有Tip时的颜色示例用蓝色 -->
<Setter Property="Background" Value="#4080FF" />
<!-- 无Tip时的颜色灰色 -->
<Style.Triggers>
<DataTrigger Binding="{Binding IsAvailable}" Value="False">
<Setter Property="Background" Value="Gray" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</DataTemplate>
<!-- 空工装模板:显示提示 -->
<DataTemplate x:Key="EmptyBoxTemplate">
<Border BorderBrush="LightGray" BorderThickness="2" CornerRadius="5" Background="#F5F5F5">
<TextBlock Text="无工装" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" Foreground="#999"/>
</Border>
</DataTemplate>
<!-- 工装类型选择器根据IBottleBox的实际类型选择模板 -->
<views:BoxTemplateSelector x:Key="BoxTemplateSelector"
SampleBoxTemplate="{StaticResource SampleBoxTemplate}"
SourceLiquidBoxTemplate="{StaticResource SourceLiquidBoxTemplate}"
PowderBoxTemplate_16ml="{StaticResource powderBoxTemplate_16ml}"
PowderBoxTemplate_125ml="{StaticResource powderBoxTemplate_125ml}"
TipHeadersBoxTemplate="{StaticResource TipHeaderBoxTemplate}"
EmptyBoxTemplate="{StaticResource EmptyBoxTemplate}">
</views:BoxTemplateSelector>
</ResourceDictionary>