| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <UserControl x:Class="LocalhostMES.Views.Tabs.PartCatalogView"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- 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:prism="http://prismlibrary.com/"
- xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
- prism:ViewModelLocator.AutoWireViewModel="True"
- mc:Ignorable="d"
- d:DesignHeight="480"
- d:DesignWidth="780">
- <b:Interaction.Triggers>
- <b:EventTrigger EventName="Loaded">
- <b:InvokeCommandAction Command="{Binding LoadedCommand}" />
- </b:EventTrigger>
- </b:Interaction.Triggers>
- <Grid Margin="10">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <TextBlock Grid.Row="0"
- Text="零件管理"
- FontSize="20"
- FontWeight="Bold"
- HorizontalAlignment="Center"
- Margin="0,0,0,16" />
- <GroupBox Grid.Row="1"
- Header="添加/编辑零件"
- Margin="0,0,0,10">
- <Grid Margin="10">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <TextBlock Grid.Row="0"
- Grid.Column="0"
- Text="名称:"
- VerticalAlignment="Center"
- Margin="5" />
- <TextBox Grid.Row="0"
- Grid.Column="1"
- Margin="5"
- MinWidth="240"
- Text="{Binding CurrentParkingLot.PartName, UpdateSourceTrigger=PropertyChanged}" />
- <TextBlock Grid.Row="1"
- Grid.Column="0"
- Text="数量:"
- VerticalAlignment="Center"
- Margin="5" />
- <TextBox Grid.Row="1"
- Grid.Column="1"
- Margin="5"
- Width="160"
- Text="{Binding CurrentParkingLot.Quantity, UpdateSourceTrigger=PropertyChanged}" />
- <StackPanel Grid.Row="2"
- Grid.Column="0"
- Grid.ColumnSpan="2"
- Orientation="Horizontal"
- HorizontalAlignment="Center"
- Margin="0,16,0,0">
- <Button Content="添加"
- Width="80"
- Height="30"
- Margin="10"
- Command="{Binding AddCommand}" />
- <Button Content="更新"
- Width="80"
- Height="30"
- Margin="10"
- Command="{Binding UpdateCommand}"
- IsEnabled="{Binding IsEditMode}" />
- <Button Content="取消编辑"
- Width="90"
- Height="30"
- Margin="10"
- Command="{Binding CancelEditCommand}"
- IsEnabled="{Binding IsEditMode}" />
- <Button Content="清空"
- Width="80"
- Height="30"
- Margin="10"
- Command="{Binding ClearFormCommand}" />
- </StackPanel>
- </Grid>
- </GroupBox>
- <GroupBox Grid.Row="2"
- Header="零件列表">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <DataGrid Grid.Row="0"
- AutoGenerateColumns="False"
- ItemsSource="{Binding ParkingLots}"
- SelectedItem="{Binding SelectedParkingLot, Mode=TwoWay}"
- CanUserAddRows="False"
- CanUserDeleteRows="False"
- SelectionMode="Single"
- SelectionUnit="FullRow"
- Margin="5"
- IsReadOnly="True">
- <DataGrid.Columns>
- <DataGridTextColumn Header="名称"
- Binding="{Binding PartName}"
- Width="*"
- MinWidth="160" />
- <DataGridTextColumn Header="数量"
- Binding="{Binding Quantity}"
- Width="100" />
- <DataGridTemplateColumn Header="操作"
- Width="160">
- <DataGridTemplateColumn.CellTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal">
- <Button Content="编辑"
- Width="56"
- Margin="2"
- Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
- CommandParameter="{Binding}" />
- <Button Content="删除"
- Width="56"
- Margin="2"
- Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
- CommandParameter="{Binding}" />
- </StackPanel>
- </DataTemplate>
- </DataGridTemplateColumn.CellTemplate>
- </DataGridTemplateColumn>
- </DataGrid.Columns>
- </DataGrid>
- <StackPanel Grid.Row="1"
- Orientation="Horizontal"
- HorizontalAlignment="Right"
- Margin="5">
- <TextBlock Text="总计:"
- FontWeight="Bold"
- Margin="5" />
- <TextBlock Text="{Binding ParkingLots.Count}"
- Foreground="Blue"
- Margin="5" />
- <TextBlock Text="条"
- Margin="5" />
- </StackPanel>
- </Grid>
- </GroupBox>
- </Grid>
- </UserControl>
|