<Window x:Class="Aucma.Core.SheetMetal.Views.CorrespondingModelPageView" 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:local="clr-namespace:Aucma.Core.SheetMetal.Views" mc:Ignorable="d" Background="#1152AC" Title="钣金生产型号维护" FontFamily="Microsoft YaHei" Height="800" Width="1300" d:DesignHeight="800" WindowStartupLocation="CenterScreen" d:DesignWidth="1500" ResizeMode="NoResize" Topmost="False"> <Window.Resources> <Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}"> <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="FontSize" Value="18"/> </Style> <Style TargetType="DataGrid"> <!--网格线颜色--> <Setter Property="CanUserResizeColumns" Value="false"/> <Setter Property="Background" Value="#1152AC" /> <Setter Property="BorderBrush" Value="#4285DE" /> <Setter Property="Foreground" Value="White"/> <Setter Property="HorizontalGridLinesBrush"> <Setter.Value> <SolidColorBrush Color="#4285DE"/> </Setter.Value> </Setter> <Setter Property="VerticalGridLinesBrush"> <Setter.Value> <SolidColorBrush Color="#1152AC"/> </Setter.Value> </Setter> </Style> <!--列头标题栏样式--> <Style TargetType="DataGridColumnHeader"> <!--<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/>--> <!--<Setter Property="Background" Value="#dddddd"/> <Setter Property="Foreground" Value="Black"/>--> <!--<Setter Property="BorderThickness" Value="1" />--> <Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="BorderBrush" Value="#dddddd" /> <Setter Property="Height" Value="40"/> <Setter Property="FontSize" Value="18"/> <Setter Property="Background" Value="#4285DE"/> <Setter Property="Foreground" Value="White"/> </Style> <!--单元格样式--> <Style TargetType="DataGridCell"> <Setter Property="FocusVisualStyle" Value="{x:Null}" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="BorderBrush" Value="White" /> <Setter Property="Height" Value="40"/> <Setter Property="FontSize" Value="12"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DataGridCell}"> <Grid Background="{TemplateBinding Background}" > <ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="#4285DE"/> <Setter Property="Foreground" Value="#dddddd"/> </Trigger> </Style.Triggers> </Style> <!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式,换行换色--> <!--<Style TargetType="DataGridRow"> <Setter Property="Height" Value="30"/> <Style.Triggers> <Trigger Property="AlternationIndex" Value="0"> <Setter Property="Background" Value="#e7e7e7"/> </Trigger> <Trigger Property="AlternationIndex" Value="1"> <Setter Property="Background" Value="#f2f2f2" /> </Trigger> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="#f1ef9f" /> </Trigger> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="#05c4ff"/> </Trigger> <Trigger Property="IsFocused" Value="True"> <Setter Property="Background" Value="#05c4ff"/> </Trigger> </Style.Triggers> </Style>--> </Window.Resources> <Border Grid.Row="1" Grid.Column="1" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Margin="5"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="0.6*"/> <RowDefinition Height="9*"/> </Grid.RowDefinitions> <Border Grid.Row="0" BorderBrush="#0288d1" BorderThickness="0,0,0,1" CornerRadius="0" Margin="1,1,5,5" > <TextBlock Text="钣金生产型号维护" FontSize="25" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/> </Border> <Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0" CornerRadius="5" Margin="1,0,5,5"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="0.1*"/> <RowDefinition/> </Grid.RowDefinitions> <WrapPanel Grid.Row="0" Margin="3" VerticalAlignment="Center"> <Label Content="查询条件" VerticalAlignment="Center" Foreground="White" FontSize="18" /> <TextBox x:Name="queryParam" PreviewMouseDoubleClick="queryParam_PreviewMouseDoubleClick" Text="{Binding Search,Mode=TwoWay}" Style="{x:Null}" Width="300" HorizontalAlignment="Left" VerticalContentAlignment="Center" Margin="10 0 5 0"/> <Button Content="查 询" Command="{Binding QueryPlanCommand}" CommandParameter="{Binding Text, ElementName=queryParam}" Margin="5 0" Height="40" FontSize="18" /> </WrapPanel> <UniformGrid Grid.Row="1" Margin="3" > <DataGrid ItemsSource="{Binding MaterialDataGrid}" Background="Transparent" ColumnHeaderHeight="40" x:Name="dgvMH" FontSize="18" RowHeight="50" AutoGenerateColumns="False" RowHeaderWidth="0" GridLinesVisibility="None" VerticalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Visible" BorderThickness="0" CanUserAddRows="False" SelectionMode="Single" IsReadOnly="True" Foreground="White" SelectedItem="{Binding SelectedDataItem}"> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding No}" Header="序号" Width="0.5*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding MaterialName}" Header="产品型号" Width="3*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTextColumn Binding="{Binding MaterialSpecificatons}" Header="配方号" Width="1.5*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" /> <DataGridTextColumn Binding="{Binding StartDate,StringFormat=\{0:MM-dd HH:mm\}}" Header="开始时间" Width="1*" IsReadOnly="True" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"/> <DataGridTemplateColumn Header="操作" Width="*" > <DataGridTemplateColumn.CellTemplate> <DataTemplate> <WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center"> <Button Content="确定" FontSize="12" CommandParameter="{Binding MaterialSpecificatons}" Background="Orange" Margin="0 2 0 2" Command="{Binding DataContext.AddBomCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=DataGrid }}" /> </WrapPanel> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid> </UniformGrid> </Grid> </Border> </Grid> </Border> </Window>