|
@@ -0,0 +1,267 @@
|
|
|
+<UserControl
|
|
|
+ x:Class="UniformMaterialManagementSystem.Views.InspectionOrganizationPage"
|
|
|
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
+ xmlns:behaviors="clr-namespace:UniformMaterialManagementSystem.Behaviors"
|
|
|
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
+ xmlns:utils="clr-namespace:UniformMaterialManagementSystem.Utils"
|
|
|
+ d:DesignHeight="450"
|
|
|
+ d:DesignWidth="800"
|
|
|
+ mc:Ignorable="d">
|
|
|
+ <UserControl.Resources>
|
|
|
+ <ControlTemplate x:Key="CustomColumnHeaderTemplate" TargetType="DataGridColumnHeader">
|
|
|
+ <Border BorderBrush="LightSlateGray" BorderThickness="0,0,1,1">
|
|
|
+ <Grid>
|
|
|
+ <Grid.ColumnDefinitions>
|
|
|
+ <ColumnDefinition />
|
|
|
+ <ColumnDefinition Width="Auto" />
|
|
|
+ </Grid.ColumnDefinitions>
|
|
|
+ <ContentPresenter
|
|
|
+ Grid.Column="0"
|
|
|
+ HorizontalAlignment="Center"
|
|
|
+ VerticalAlignment="Center" />
|
|
|
+ <Path
|
|
|
+ x:Name="SortArrow"
|
|
|
+ Grid.Column="1"
|
|
|
+ Margin="0,0,5,0"
|
|
|
+ VerticalAlignment="Center"
|
|
|
+ Data="M 0 0 L 10 0 L 5 5 Z"
|
|
|
+ Fill="Gray"
|
|
|
+ Visibility="Collapsed" />
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+ <ControlTemplate.Triggers>
|
|
|
+ <Trigger Property="SortDirection" Value="Ascending">
|
|
|
+ <Setter TargetName="SortArrow" Property="Data" Value="M 0 5 L 10 5 L 5 0 Z" />
|
|
|
+ <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="SortDirection" Value="Descending">
|
|
|
+ <Setter TargetName="SortArrow" Property="Data" Value="M 0 0 L 10 0 L 5 5 Z" />
|
|
|
+ <Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
|
|
|
+ </Trigger>
|
|
|
+ </ControlTemplate.Triggers>
|
|
|
+ </ControlTemplate>
|
|
|
+
|
|
|
+ <Style x:Key="CustomColumnHeaderStyle" TargetType="DataGridColumnHeader">
|
|
|
+ <Setter Property="Background" Value="White" />
|
|
|
+ <Setter Property="Foreground" Value="Black" />
|
|
|
+ <Setter Property="FontWeight" Value="Bold" />
|
|
|
+ <Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
|
+ <Setter Property="VerticalContentAlignment" Value="Center" />
|
|
|
+ <Setter Property="Height" Value="40" />
|
|
|
+ <Setter Property="Template" Value="{StaticResource CustomColumnHeaderTemplate}" />
|
|
|
+
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <Style x:Key="CustomRowHeaderStyle" TargetType="DataGridRowHeader">
|
|
|
+ <Setter Property="Background" Value="White" />
|
|
|
+ <Setter Property="Foreground" Value="Black" />
|
|
|
+ <Setter Property="BorderThickness" Value="0,0,1,1" />
|
|
|
+ <Setter Property="BorderBrush" Value="LightSlateGray" />
|
|
|
+ <Setter Property="Padding" Value="10,0,10,0" />
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <Style x:Key="CustomRowStyle" TargetType="DataGridRow">
|
|
|
+ <Setter Property="Background" Value="White" />
|
|
|
+ <Setter Property="FontSize" Value="14" />
|
|
|
+ <Setter Property="Height" Value="30" />
|
|
|
+
|
|
|
+ <Style.Triggers>
|
|
|
+ <Trigger Property="AlternationIndex" Value="1">
|
|
|
+ <Setter Property="Background" Value="WhiteSmoke" />
|
|
|
+ </Trigger>
|
|
|
+ <Trigger Property="IsSelected" Value="True">
|
|
|
+ <Setter Property="Background" Value="LightBlue" />
|
|
|
+ </Trigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+ <Style
|
|
|
+ x:Key="CustomCellStyle"
|
|
|
+ BasedOn="{StaticResource {x:Type DataGridCell}}"
|
|
|
+ TargetType="DataGridCell">
|
|
|
+ <Setter Property="Background" Value="White" />
|
|
|
+ <Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
|
+ <Setter Property="VerticalContentAlignment" Value="Center" />
|
|
|
+ <Setter Property="Padding" Value="10" />
|
|
|
+ <Style.Triggers>
|
|
|
+ <Trigger Property="IsSelected" Value="True">
|
|
|
+ <Setter Property="Background" Value="LightBlue" />
|
|
|
+ <Setter Property="Foreground" Value="Black" />
|
|
|
+ </Trigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+ </UserControl.Resources>
|
|
|
+
|
|
|
+ <Grid>
|
|
|
+ <Grid.RowDefinitions>
|
|
|
+ <RowDefinition Height="Auto" />
|
|
|
+ <RowDefinition Height="*" />
|
|
|
+ </Grid.RowDefinitions>
|
|
|
+ <!-- 菜单项 -->
|
|
|
+ <Border
|
|
|
+ Grid.Row="0"
|
|
|
+ BorderBrush="Gray"
|
|
|
+ BorderThickness="1">
|
|
|
+ <ToolBarPanel>
|
|
|
+ <ToolBar Background="White" ToolBarTray.IsLocked="True">
|
|
|
+ <Button HorizontalContentAlignment="Center" Command="{Binding AddInspectionOrganizationCommand}">
|
|
|
+ <Button.Template>
|
|
|
+ <ControlTemplate>
|
|
|
+ <Border
|
|
|
+ Width="40"
|
|
|
+ Background="{TemplateBinding Background}"
|
|
|
+ CornerRadius="5">
|
|
|
+ <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
|
|
|
+ <TextBlock
|
|
|
+ HorizontalAlignment="Center"
|
|
|
+ FontFamily="{StaticResource FluentSystemIconsRegular}"
|
|
|
+ FontSize="20"
|
|
|
+ Text="{x:Static utils:RegularFontUtil.Add_Circle_32}" />
|
|
|
+ <TextBlock Text="新增" />
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+ <ControlTemplate.Triggers>
|
|
|
+ <Trigger Property="IsMouseOver" Value="True">
|
|
|
+ <Setter Property="Background" Value="LightGray" />
|
|
|
+ </Trigger>
|
|
|
+ </ControlTemplate.Triggers>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Button.Template>
|
|
|
+ </Button>
|
|
|
+
|
|
|
+ <Button Command="{Binding RemoveInspectionOrganizationCommand}">
|
|
|
+ <Button.Template>
|
|
|
+ <ControlTemplate>
|
|
|
+ <Border
|
|
|
+ Width="40"
|
|
|
+ Background="{TemplateBinding Background}"
|
|
|
+ CornerRadius="5">
|
|
|
+ <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
|
|
|
+ <TextBlock
|
|
|
+ HorizontalAlignment="Center"
|
|
|
+ FontFamily="{StaticResource FluentSystemIconsRegular}"
|
|
|
+ FontSize="20"
|
|
|
+ Text="{x:Static utils:RegularFontUtil.Delete_48}" />
|
|
|
+ <TextBlock Text="删除" />
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+ <ControlTemplate.Triggers>
|
|
|
+ <Trigger Property="IsMouseOver" Value="True">
|
|
|
+ <Setter Property="Background" Value="LightGray" />
|
|
|
+ </Trigger>
|
|
|
+ </ControlTemplate.Triggers>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Button.Template>
|
|
|
+ </Button>
|
|
|
+ <Button Command="{Binding SaveInspectionOrganizationCommand}">
|
|
|
+ <Button.Template>
|
|
|
+ <ControlTemplate>
|
|
|
+ <Border
|
|
|
+ Width="40"
|
|
|
+ Background="{TemplateBinding Background}"
|
|
|
+ CornerRadius="5">
|
|
|
+ <StackPanel HorizontalAlignment="Center" Orientation="Vertical">
|
|
|
+ <TextBlock
|
|
|
+ HorizontalAlignment="Center"
|
|
|
+ FontFamily="{StaticResource FluentSystemIconsRegular}"
|
|
|
+ FontSize="20"
|
|
|
+ Text="{x:Static utils:RegularFontUtil.Save_32}" />
|
|
|
+ <TextBlock Text="保存" />
|
|
|
+ </StackPanel>
|
|
|
+ </Border>
|
|
|
+ <ControlTemplate.Triggers>
|
|
|
+ <Trigger Property="IsMouseOver" Value="True">
|
|
|
+ <Setter Property="Background" Value="LightGray" />
|
|
|
+ </Trigger>
|
|
|
+ </ControlTemplate.Triggers>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Button.Template>
|
|
|
+ </Button>
|
|
|
+ </ToolBar>
|
|
|
+ </ToolBarPanel>
|
|
|
+ </Border>
|
|
|
+
|
|
|
+ <!-- 表格DataGird -->
|
|
|
+ <DataGrid
|
|
|
+ x:Name="DataGridMain"
|
|
|
+ Grid.Row="1"
|
|
|
+ behaviors:DataGridBehavior.RowNumbers="True"
|
|
|
+ AutoGenerateColumns="False"
|
|
|
+ Background="White"
|
|
|
+ CanUserAddRows="False"
|
|
|
+ CanUserReorderColumns="True"
|
|
|
+ CanUserResizeColumns="True"
|
|
|
+ CellStyle="{StaticResource CustomCellStyle}"
|
|
|
+ ColumnHeaderStyle="{StaticResource CustomColumnHeaderStyle}"
|
|
|
+ HeadersVisibility="All"
|
|
|
+ HorizontalGridLinesBrush="LightSlateGray"
|
|
|
+ ItemsSource="{Binding InspectionOrganizations, Mode=TwoWay}"
|
|
|
+ RowHeaderStyle="{StaticResource CustomRowHeaderStyle}"
|
|
|
+ RowStyle="{StaticResource CustomRowStyle}"
|
|
|
+ SelectedItem="{Binding SelectedInspectionOrganization, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
+ SelectionMode="Single"
|
|
|
+ SelectionUnit="FullRow"
|
|
|
+ VerticalGridLinesBrush="LightSlateGray">
|
|
|
+
|
|
|
+ <DataGrid.Resources>
|
|
|
+ <!-- 非编辑模式下文本居中的样式 -->
|
|
|
+ <Style x:Key="TextColumnElementStyle" TargetType="TextBlock">
|
|
|
+ <Setter Property="HorizontalAlignment" Value="Center" />
|
|
|
+ <Setter Property="VerticalAlignment" Value="Center" />
|
|
|
+ <Setter Property="TextAlignment" Value="Center" />
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <!-- 编辑模式下文本居中的样式 -->
|
|
|
+ <Style x:Key="TextColumnEditingElementStyle" TargetType="TextBox">
|
|
|
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
|
|
|
+ <Setter Property="VerticalAlignment" Value="Stretch" />
|
|
|
+ <Setter Property="VerticalContentAlignment" Value="Center" />
|
|
|
+ </Style>
|
|
|
+
|
|
|
+ <Style x:Key="CheckBoxColumnElementStyle" TargetType="CheckBox">
|
|
|
+ <Setter Property="HorizontalAlignment" Value="Center" />
|
|
|
+ <Setter Property="VerticalAlignment" Value="Center" />
|
|
|
+ </Style>
|
|
|
+ </DataGrid.Resources>
|
|
|
+ <DataGrid.Columns>
|
|
|
+ <DataGridTextColumn
|
|
|
+ Width="50"
|
|
|
+ Binding="{Binding OrderNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
+ EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
|
|
|
+ ElementStyle="{StaticResource TextColumnElementStyle}"
|
|
|
+ Header="编号*" />
|
|
|
+ <DataGridTextColumn
|
|
|
+ Width="300"
|
|
|
+ Binding="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
+ EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
|
|
|
+ ElementStyle="{StaticResource TextColumnElementStyle}"
|
|
|
+ Header="检测机构名称*" />
|
|
|
+ <DataGridTextColumn
|
|
|
+ Width="500"
|
|
|
+ Binding="{Binding Address, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
+ EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
|
|
|
+ ElementStyle="{StaticResource TextColumnElementStyle}"
|
|
|
+ Header="地址*" />
|
|
|
+ <DataGridTextColumn
|
|
|
+ Width="150"
|
|
|
+ Binding="{Binding Contacts, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
+ EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
|
|
|
+ ElementStyle="{StaticResource TextColumnElementStyle}"
|
|
|
+ Header="联系人*" />
|
|
|
+ <DataGridTextColumn
|
|
|
+ Width="150"
|
|
|
+ Binding="{Binding Telephone, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
+ EditingElementStyle="{StaticResource TextColumnEditingElementStyle}"
|
|
|
+ ElementStyle="{StaticResource TextColumnElementStyle}"
|
|
|
+ Header="联系电话*" />
|
|
|
+ <DataGridCheckBoxColumn
|
|
|
+ Width="100"
|
|
|
+ Binding="{Binding IsEnabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
+ ElementStyle="{StaticResource CheckBoxColumnElementStyle}"
|
|
|
+ Header="使用状态" />
|
|
|
+
|
|
|
+ </DataGrid.Columns>
|
|
|
+ </DataGrid>
|
|
|
+ </Grid>
|
|
|
+</UserControl>
|