You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
8.8 KiB

<UserControl x:Class="Gumming.PatternControlView"
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"
mc:Ignorable="d"
xmlns:local="clr-namespace:Gumming"
xmlns:tool="clr-namespace:GummingCommon;assembly=GummingCommon"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
d:DesignHeight="800" d:DesignWidth="1366"
SizeChanged="RootControl_SizeChanged"
PreviewMouseDown="RootControl_PreviewMouseDown"
Background="Transparent"
x:Name="rootControl">
<UserControl.Resources>
<tool:RadioButtonConverter x:Key="RadioConverter"/>
<tool:IntToVisibilityConverter x:Key="IntConverter"/>
<tool:TagStyleConverter x:Key="TagStyleConverter"/>
<tool:StartStyleConverter x:Key="StartStyleConverter"/>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="3"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
</Style>
<Style TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="White"/>
<Setter Property="Margin" Value="2"/>
</Style>
<DataTemplate x:Key="PortFieldMapping">
<Border Name="ItemBorder" Height="30" BorderThickness="0" BorderBrush="Black">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="55"></ColumnDefinition>
<ColumnDefinition Width="55"></ColumnDefinition>
<ColumnDefinition Width="55"></ColumnDefinition>
<ColumnDefinition Width="40"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" >
<TextBlock Text="{Binding PortCode, Mode=TwoWay}" ToolTip="{Binding PositionDist}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontSize="14" FontWeight="Bold"></TextBlock>
</Border>
<Border Grid.Column="1" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<TextBox Style="{DynamicResource EditTextBoxStyle}" Text="{Binding PortName, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ToolTip="{Binding PortName}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontSize="14" FontWeight="Bold"></TextBox>
</Border>
<Border Grid.Column="2" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" >
<TextBlock Text="{Binding GroupType, Mode=TwoWay}" ToolTip="{Binding GroupType}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontSize="14" FontWeight="Bold"></TextBlock>
</Border>
<Border Grid.Column="3" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" >
<TextBlock Text="{Binding PositionType, Mode=TwoWay}" ToolTip="{Binding PositionType}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontSize="14" FontWeight="Bold"></TextBlock>
</Border>
<Border Grid.Column="4" BorderThickness="1,0,1,1" BorderBrush="{DynamicResource BaseBrushBorder}" >
</Border>
</Grid>
</Border>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType={x:Type ListViewItem}}, Path=IsSelected}" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="#DDD"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</UserControl.Resources>
<Grid Background="Red">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="55"></ColumnDefinition>
<ColumnDefinition Width="55"></ColumnDefinition>
<ColumnDefinition Width="55"></ColumnDefinition>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="20"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="端口编号" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="1" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="端口名称" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="2" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="标号" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="3" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="电柜" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="4" BorderThickness="1,1,1,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
</Border>
</Grid>
<ListView x:Name="FieldMappingView" tool:TouchScrolling.IsEnabled="True" Grid.Row="1" ItemTemplate="{DynamicResource PortFieldMapping}" ItemsSource="{Binding HartPorts}"
Template="{DynamicResource ListViewItemMapping}" ItemContainerStyle="{DynamicResource ListViewItemContainerStyle}" BorderThickness="0"
SelectedValue="{Binding NormalDoubleCut}" SelectionMode="Single" Foreground="{DynamicResource FontBrush4}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<tool:ExecuteCommandAction CommandParameter="{Binding SelectedItems, ElementName=FieldMappingView}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ListView>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column="2" Margin="2" FontSize="15" Style="{DynamicResource CommonIconButton}" Command="{Binding AddPositionCommand}" Content="新增"></Button>
<Button Grid.Column="4" Margin="2" FontSize="15" Style="{DynamicResource CommonIconButton}" Command="{Binding ClearPositionCommand}" Content="清空"></Button>
<Button Grid.Column="6" Margin="2" FontSize="15" Style="{DynamicResource CommonIconButton}" Command="{Binding SavePositionCommand}" Content="保存"></Button>
</Grid>
</Grid>
</Grid>
</UserControl>