<UserControl x:Class="XHandler.View.Liquids.CalibrationParam"
|
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:XHandler.View.Liquids"
|
xmlns:str="clr-namespace:XHandler.Properties"
|
xmlns:ctrls="clr-namespace:XHandler.Controls"
|
mc:Ignorable="d"
|
d:DesignHeight="450" d:DesignWidth="800">
|
|
<UserControl.Resources>
|
<Style TargetType="TextBlock" x:Key="centerAlignmentStyle">
|
<Setter Property="Foreground" Value="Black"/>
|
<Setter Property="FontSize" Value="16"/>
|
<Setter Property="HorizontalAlignment" Value="Center"/>
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
<Setter Property="TextWrapping" Value="Wrap"/>
|
</Style>
|
|
<!--DataGrid样式-->
|
<Style TargetType="DataGrid">
|
<!--网格线颜色-->
|
<Setter Property="CanUserResizeColumns" Value="false"/>
|
<Setter Property="Background" Value="White" />
|
<Setter Property="BorderBrush" Value="LightGray" />
|
<Setter Property="HorizontalGridLinesBrush">
|
<Setter.Value>
|
<SolidColorBrush Color="LightGray"/>
|
</Setter.Value>
|
</Setter>
|
<Setter Property="VerticalGridLinesBrush">
|
<Setter.Value>
|
<SolidColorBrush Color="LightGray"/>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<!--标题栏样式-->
|
<Style TargetType="DataGridColumnHeader">
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
<Setter Property="MinWidth" Value="0" />
|
<Setter Property="MinHeight" Value="28" />
|
<Setter Property="Foreground" Value="#323433" />
|
<Setter Property="FontSize" Value="16" />
|
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="DataGridColumnHeader">
|
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1"
|
BorderBrush="LightGray"
|
Width="Auto">
|
<Grid >
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="*" />
|
</Grid.ColumnDefinitions>
|
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
<Rectangle Width="1" Fill="LightGray" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
|
</Grid>
|
</Border>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
<Setter Property="Height" Value="60"/>
|
</Style>
|
|
<!--行样式触发-->
|
<!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式-->
|
<Style TargetType="DataGridRow">
|
<Setter Property="Background" Value="White" />
|
<Setter Property="Height" Value="60"/>
|
<Setter Property="FontSize" Value="16" />
|
<Setter Property="Foreground" Value="Black" />
|
<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="LightGray"/>
|
<!--<Setter Property="Foreground" Value="White"/>-->
|
</Trigger>
|
|
<Trigger Property="IsSelected" Value="True">
|
<Setter Property="Background" Value="{DynamicResource lightBlueBrush}"/>
|
|
</Trigger>
|
</Style.Triggers>
|
</Style>
|
|
<!--单元格样式触发-->
|
<Style TargetType="DataGridCell">
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="DataGridCell">
|
<TextBlock TextAlignment="Center" VerticalAlignment="Center" >
|
<ContentPresenter />
|
</TextBlock>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
<Style.Triggers>
|
<Trigger Property="IsSelected" Value="True">
|
<Setter Property="Foreground" Value="Black"/>
|
</Trigger>
|
</Style.Triggers>
|
</Style>
|
|
<Style x:Key="CellEditStyle" TargetType="{x:Type TextBox}">
|
<Setter Property="BorderThickness" Value="0"/>
|
<Setter Property="Padding" Value="0"/>
|
<Style.Triggers>
|
<Trigger Property="Validation.HasError" Value="true">
|
<Setter Property="ToolTip"
|
Value="{Binding RelativeSource={RelativeSource Self},
|
Path=(Validation.Errors)[0].ErrorContent}"/>
|
</Trigger>
|
</Style.Triggers>
|
</Style>
|
<Style x:Key="CellNonEditStyle" TargetType="{x:Type TextBlock}">
|
|
<Style.Triggers>
|
<Trigger Property="Validation.HasError" Value="true">
|
<Setter Property="ToolTip"
|
Value="{Binding RelativeSource={RelativeSource Self},
|
Path=(Validation.Errors)[0].ErrorContent}"/>
|
</Trigger>
|
</Style.Triggers>
|
</Style>
|
|
<Style x:Key="CellViewStyle" TargetType="{x:Type Label}" BasedOn="{StaticResource {x:Type Label}}">
|
<Style.Triggers>
|
<Trigger Property="Validation.HasError" Value="true">
|
<Setter Property="ToolTip"
|
Value="{Binding RelativeSource={RelativeSource Self},
|
Path=(Validation.Errors)[0].ErrorContent}"/>
|
<Setter Property="BorderBrush" Value="Red" />
|
<Setter Property="BorderThickness" Value="1" />
|
</Trigger>
|
</Style.Triggers>
|
</Style>
|
|
<Style x:Key="eidtTextBoxStyle" TargetType="TextBox">
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate >
|
<Grid>
|
<Border x:Name="BackBorder" SnapsToDevicePixels="true" Background="{TemplateBinding Background}"
|
BorderThickness="0" BorderBrush="{TemplateBinding BorderBrush}">
|
<ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
</Border>
|
</Grid>
|
<ControlTemplate.Triggers>
|
<!--<Trigger Property="IsFocused" Value="True" >
|
<Setter Property="Background" TargetName="BackBorder" Value="#FFE5E6EB"/>
|
</Trigger>-->
|
<Trigger Property="IsEnabled" Value="False">
|
<Setter Property="TextBox.Foreground" Value="Gray"/>
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
</UserControl.Resources>
|
|
<Grid Name="gdContent">
|
<Grid.RowDefinitions>
|
<RowDefinition Height="auto"/>
|
<RowDefinition Height="60"/>
|
</Grid.RowDefinitions>
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="*" x:Name="calibrationWidth"/>
|
</Grid.ColumnDefinitions>
|
|
<DataGrid x:Name="dg" AutoGenerateColumns="False" VerticalAlignment="Top" HorizontalAlignment="Center" BorderThickness="1 0 0 0"
|
CanUserSortColumns="False" Margin="20 20" Grid.Row="0" Grid.Column="0"
|
CanUserResizeColumns="False" CanUserResizeRows="False"
|
CanUserReorderColumns="False" RowHeaderWidth="0" CanUserAddRows="False"
|
BeginningEdit="dg_BeginningEdit" CellEditEnding="dg_CellEditEnding" Width="680">
|
<DataGrid.Columns>
|
<DataGridTemplateColumn Width="5*" Header="{x:Static str:Resources.strTargetVolumn}" >
|
<DataGridTemplateColumn.CellTemplate>
|
<DataTemplate>
|
<Label Content="{Binding liquid_target_volume}" Tag="{Binding liquidaccuracy_Id}" Foreground="Black" ToolTip="双击编辑"/>
|
</DataTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellEditingTemplate>
|
<DataTemplate>
|
<TextBox x:Name="tbTarget" Text="{Binding Path=liquid_target_volume}"
|
Style="{DynamicResource eidtTextBoxStyle}" Tag="{Binding liquidaccuracy_Id}" Width="200" Height="50" FontSize="16" HorizontalContentAlignment="Center"
|
VerticalContentAlignment="Center"/>
|
</DataTemplate>
|
</DataGridTemplateColumn.CellEditingTemplate>
|
</DataGridTemplateColumn>
|
|
<DataGridTemplateColumn Width="5*" Header="{x:Static str:Resources.strCorrectVolumn}" >
|
<DataGridTemplateColumn.CellTemplate>
|
<DataTemplate>
|
<Label Content="{Binding liquid_Real_volume}" Tag="{Binding liquidaccuracy_Id}" Foreground="Black" ToolTip="双击编辑"/>
|
</DataTemplate>
|
</DataGridTemplateColumn.CellTemplate>
|
<DataGridTemplateColumn.CellEditingTemplate>
|
<DataTemplate>
|
<TextBox x:Name="tbTargetReal" Text="{Binding Path=liquid_Real_volume}"
|
Style="{DynamicResource eidtTextBoxStyle}" Tag="{Binding liquidaccuracy_Id}" Width="200" Height="50" FontSize="16" HorizontalContentAlignment="Center"
|
VerticalContentAlignment="Center"/>
|
</DataTemplate>
|
</DataGridTemplateColumn.CellEditingTemplate>
|
</DataGridTemplateColumn>
|
</DataGrid.Columns>
|
</DataGrid>
|
|
<Button Grid.Row="1" Grid.Column="0" x:Name="btnDelete" Content="{x:Static str:Resources.btnRemove}" Width="80" Height="40" VerticalContentAlignment="Center"
|
HorizontalAlignment="Right" VerticalAlignment="Center" Margin="120 0" FontSize="16" Style="{DynamicResource BlueButtonStyle}"
|
Background="{DynamicResource blueBrush}" Click="btnDelete_Click"/>
|
|
<Button Grid.Row="1" Grid.Column="0" x:Name="btnAdd" Content="{x:Static str:Resources.btnAdd}" Width="80" Height="40" VerticalContentAlignment="Center"
|
HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 20 0" FontSize="16" Style="{DynamicResource BlueButtonStyle}"
|
Background="{DynamicResource blueBrush}" Click="btnAdd_Click"/>
|
|
<TextBlock Grid.Row="1" Grid.Column="0" x:Name="lnError" Text="{Binding ElementName=dg,Path=(Validation.Errors)[0].ErrorContent}" Foreground="Red" FontSize="16"
|
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="50 5 5 5"/>
|
</Grid>
|
</UserControl>
|