87 lines
5.4 KiB
Plaintext
87 lines
5.4 KiB
Plaintext
![]() |
<Page x:Class="Seyounth.Hyosung.UI.Views.Pages.PalletManagementPage"
|
||
|
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:Seyounth.Hyosung.UI.Views.Pages"
|
||
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||
|
xmlns:models="clr-namespace:Seyounth.Hyosung.Data.Models;assembly=Seyounth.Hyosung.Data"
|
||
|
xmlns:helpers="clr-namespace:Seyounth.Hyosung.UI.Helpers"
|
||
|
mc:Ignorable="d"
|
||
|
x:Name="PalletPage"
|
||
|
Title="PalletManagementPage"
|
||
|
d:DataContext="{d:DesignInstance local:PalletManagementPage,
|
||
|
IsDesignTimeCreatable=False}"
|
||
|
d:DesignHeight="450"
|
||
|
d:DesignWidth="800"
|
||
|
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
|
||
|
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||
|
ScrollViewer.CanContentScroll="False">
|
||
|
<Page.Resources>
|
||
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||
|
<helpers:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
||
|
</Page.Resources>
|
||
|
<Grid>
|
||
|
<Grid.RowDefinitions>
|
||
|
<RowDefinition Height="Auto" />
|
||
|
<RowDefinition Height="*" />
|
||
|
</Grid.RowDefinitions>
|
||
|
<Menu>
|
||
|
<ui:MenuItem Command="{Binding ViewModel.AddPalletCommand }" Header="新增" Icon="{ui:SymbolIcon Add24}" />
|
||
|
</Menu>
|
||
|
<ui:DataGrid x:Name="PalletsDataGrid" Margin="0,0,0,20" AutoGenerateColumns="False"
|
||
|
HeadersVisibility="All"
|
||
|
VerticalContentAlignment="Center"
|
||
|
CanUserAddRows="False"
|
||
|
AddingNewItem="PalletsDataGrid_AddingNewItem"
|
||
|
|
||
|
CellEditEnding="PalletDataGrid_CellEditEnding"
|
||
|
ItemsSource="{Binding ViewModel.Pallets, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||
|
Grid.Row="1">
|
||
|
<ui:DataGrid.Columns>
|
||
|
<DataGridTextColumn IsReadOnly="True" Header="编号(Id)"
|
||
|
Binding="{Binding Id}" />
|
||
|
<DataGridTemplateColumn Width="120" Header="托盘类型(Type)">
|
||
|
<DataGridTemplateColumn.CellTemplate>
|
||
|
<DataTemplate>
|
||
|
<ComboBox SelectedItem="{Binding Type, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||
|
SelectionChanged="ComboBox_SelectionChanged"
|
||
|
ItemsSource="{Binding Source={helpers:EnumBindingSource {x:Type models:PalletType}}}">
|
||
|
<ComboBox.ItemTemplate>
|
||
|
<DataTemplate>
|
||
|
<TextBlock
|
||
|
Text="{Binding ., Converter={StaticResource EnumDescriptionConverter}}" />
|
||
|
</DataTemplate>
|
||
|
</ComboBox.ItemTemplate>
|
||
|
</ComboBox>
|
||
|
</DataTemplate>
|
||
|
</DataGridTemplateColumn.CellTemplate>
|
||
|
</DataGridTemplateColumn>
|
||
|
<DataGridTextColumn Width="120" Header="长度(Length)" Binding="{Binding Length}" />
|
||
|
<DataGridTextColumn Width="120" Header="宽度(Width)" Binding="{Binding Width}" />
|
||
|
<DataGridTextColumn Width="120" Header="高度(Height)" Binding="{Binding Height}" />
|
||
|
<DataGridCheckBoxColumn Header="大孔(BigHole)" Binding="{Binding IsBigHole}" />
|
||
|
<DataGridTextColumn Width="120" Header="孔数(HoleCount)" Binding="{Binding HoleCount}" />
|
||
|
<DataGridTemplateColumn Header="操作">
|
||
|
<DataGridTemplateColumn.CellTemplate>
|
||
|
<DataTemplate>
|
||
|
<StackPanel Orientation="Horizontal">
|
||
|
<ui:Button Appearance="Primary" VerticalAlignment="Center" Margin="10,0,10,0"
|
||
|
Content="保存"
|
||
|
Command="{Binding ElementName=PalletPage, Path=DataContext.ViewModel.SavePalletCommand}"
|
||
|
CommandParameter="{Binding}"
|
||
|
Visibility="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, Path=IsEditing, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||
|
<!-- 删除按钮 -->
|
||
|
<ui:Button VerticalAlignment="Center" Content="删除" Margin="10,0,10,0"
|
||
|
Command="{Binding ElementName=PalletPage, Path=DataContext.ViewModel.DeletePalletCommand}"
|
||
|
CommandParameter="{Binding}" />
|
||
|
<!-- 保存按钮,根据 DataGridRow 的 IsEditing 属性控制可见性 -->
|
||
|
</StackPanel>
|
||
|
</DataTemplate>
|
||
|
</DataGridTemplateColumn.CellTemplate>
|
||
|
</DataGridTemplateColumn>
|
||
|
</ui:DataGrid.Columns>
|
||
|
</ui:DataGrid>
|
||
|
</Grid>
|
||
|
</Page>
|