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.
74 lines
4.6 KiB
74 lines
4.6 KiB
<UserControl x:Class="Gumming.IOView"
|
|
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="700" d:DesignWidth="1000"
|
|
Background="Transparent"
|
|
x:Name="rootControl">
|
|
<UserControl.Resources>
|
|
<tool:IsOpenConverter x:Key="IsOpenConverter"/>
|
|
<DataTemplate x:Key="PortFieldMapping">
|
|
<Border Name="ItemBorder" Height="40" Width="140" BorderThickness="0">
|
|
<Grid Margin="2">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition></RowDefinition>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="30"></ColumnDefinition>
|
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
|
<ColumnDefinition Width="20"></ColumnDefinition>
|
|
<ColumnDefinition Width="20"></ColumnDefinition>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Text="{Binding PortCode, Mode=TwoWay}" ToolTip="{Binding WarnName}" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="10" ></TextBlock>
|
|
<TextBlock Grid.Column="1" Text="{Binding PortName, Mode=TwoWay}" ToolTip="{Binding PortName}" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="10" TextTrimming="CharacterEllipsis"></TextBlock>
|
|
<Rectangle Grid.Column="2" Fill="{Binding Path=IsOpen,Converter={StaticResource IsOpenConverter}}" RadiusX="5" RadiusY="5" Width="10" Height="10"></Rectangle>
|
|
</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>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*"></RowDefinition>
|
|
<RowDefinition Height="30"></RowDefinition>
|
|
</Grid.RowDefinitions>
|
|
<ListView x:Name="FieldMappingView" tool:TouchScrolling.IsEnabled="True" ItemTemplate="{DynamicResource PortFieldMapping}" ItemsSource="{Binding Ports}"
|
|
ItemContainerStyle="{DynamicResource ListViewItemContainerStyle}" BorderThickness="0"
|
|
SelectedValue="{Binding SelectedWarning}" SelectionMode="Single" Foreground="{DynamicResource FontBrush4}">
|
|
<ListBox.Template>
|
|
<ControlTemplate TargetType="{x:Type ListBox}">
|
|
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
|
<WrapPanel Orientation="Horizontal" IsItemsHost="True" ScrollViewer.CanContentScroll="True"/>
|
|
</ScrollViewer>
|
|
</ControlTemplate>
|
|
</ListBox.Template>
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="SelectionChanged">
|
|
<tool:ExecuteCommandAction CommandParameter="{Binding SelectedItems, ElementName=FieldMappingView}"/>
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
</ListView>
|
|
<Grid Grid.Row="1">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
|
<ColumnDefinition Width="80"></ColumnDefinition>
|
|
<ColumnDefinition Width="5"></ColumnDefinition>
|
|
<ColumnDefinition Width="80"></ColumnDefinition>
|
|
<ColumnDefinition Width="5"></ColumnDefinition>
|
|
</Grid.ColumnDefinitions>
|
|
<Button Grid.Column="1" Margin="2" FontSize="14" Style="{DynamicResource CommonIconButton}" Command="{Binding InputCommand}" Content="输入"></Button>
|
|
<Button Grid.Column="3" Margin="2" FontSize="14" Style="{DynamicResource CommonIconButton}" Command="{Binding OutputCommand}" Content="输出"></Button>
|
|
</Grid>
|
|
</Grid>
|
|
</UserControl>
|