77 lines
5.0 KiB
XML
77 lines
5.0 KiB
XML
<UserControl xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:viewModels="clr-namespace:Seyounth.Hyosung.Ava.ViewModels"
|
|
xmlns:views="clr-namespace:Seyounth.Hyosung.Ava.Views"
|
|
xmlns:models="clr-namespace:Seyounth.Hyosung.Data.Models;assembly=Seyounth.Hyosung.Data"
|
|
xmlns:helpers="clr-namespace:Seyounth.Hyosung.UI.Helpers"
|
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
xmlns:suki="https://github.com/kikipoulet/SukiUI"
|
|
x:DataType="viewModels:PalletManagerViewModel"
|
|
x:Name="PalletPage"
|
|
x:Class="Seyounth.Hyosung.Ava.Views.PalletManagerPage">
|
|
<UserControl.Resources>
|
|
<helpers:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
|
</UserControl.Resources>
|
|
|
|
<suki:SukiStackPage>
|
|
<suki:SukiStackPage.Content>
|
|
<Grid x:Name="辅料管理" RowDefinitions="Auto,*">
|
|
<StackPanel Margin="20" Orientation="Horizontal">
|
|
<Button Content="新增" Classes="Outlined" Command="{Binding AddNewRowCommand }" />
|
|
</StackPanel>
|
|
<DataGrid Grid.Row="1" GridLinesVisibility="All"
|
|
ItemsSource="{Binding Pallets, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
|
<DataGrid.Columns>
|
|
<DataGridTextColumn Header="ID"
|
|
IsReadOnly="True"
|
|
Binding="{Binding Id}" />
|
|
<DataGridTemplateColumn Header="辅料类型">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<ComboBox SelectedItem="{Binding Type, Mode=TwoWay}"
|
|
ItemsSource="{Binding Source={helpers:EnumBindingSource {x:Type models:PalletType}}}"
|
|
SelectionChanged="ComboBox_SelectionChanged">
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock
|
|
Text="{Binding ., Converter={StaticResource EnumDescriptionConverter}}" />
|
|
</DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
<DataGridTextColumn Header="长度(Length)" Binding="{Binding Length}" />
|
|
<DataGridTextColumn Header="宽度(Width)" Binding="{Binding Width}" />
|
|
<DataGridTextColumn Header="高度(Height)" Binding="{Binding Height}" />
|
|
<DataGridCheckBoxColumn Header="大孔(BigHole)" Binding="{Binding IsBigHole}" />
|
|
<DataGridTextColumn Header="孔数(HoleCount)" Binding="{Binding HoleCount}" />
|
|
<DataGridTemplateColumn Header="操作">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Horizontal">
|
|
<Button VerticalAlignment="Center" Margin="10,0,10,0"
|
|
Content="修改"
|
|
Classes="Outlined Accent"
|
|
Command="{Binding ElementName=PalletPage, Path=ViewModel.SavePalletCommand}"
|
|
CommandParameter="{Binding}"
|
|
IsVisible="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, Path=IsEditing}" />
|
|
<!-- 删除按钮 -->
|
|
<Button VerticalAlignment="Center" Content="删除" Margin="10,0,10,0"
|
|
Command="{Binding ElementName=PalletPage, Path=ViewModel.DeletePalletCommand}"
|
|
CommandParameter="{Binding}" />
|
|
<!-- 保存按钮,根据 DataGridRow 的 IsEditing 属性控制可见性 -->
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
</Grid>
|
|
</suki:SukiStackPage.Content>
|
|
|
|
</suki:SukiStackPage>
|
|
|
|
</UserControl> |