134 lines
8.5 KiB
Plaintext
134 lines
8.5 KiB
Plaintext
|
<UserControl x:Class="MECF.Framework.UI.Client.CenterViews.Maitenances.Connections.ConnectionView"
|
||
|
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:connections="clr-namespace:MECF.Framework.UI.Client.CenterViews.Maitenances.Connections"
|
||
|
mc:Ignorable="d" >
|
||
|
<UserControl.Resources>
|
||
|
<connections:BoolBackgroundConverter x:Key="BoolBackgroundConverter"/>
|
||
|
|
||
|
<SolidColorBrush x:Key="DataGrid_Cell_BD" Color="Gray"/>
|
||
|
|
||
|
|
||
|
<Style x:Key="Lamp-Button" TargetType="{x:Type connections:IoButton}">
|
||
|
<Setter Property="Width" Value="16"/>
|
||
|
<Setter Property="Height" Value="16"/>
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="{x:Type connections:IoButton}">
|
||
|
<Grid>
|
||
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True" Content=""/>
|
||
|
|
||
|
<Ellipse Stroke="Gray" StrokeThickness="2"
|
||
|
Fill="DarkGray" />
|
||
|
<Ellipse x:Name="Highlight" Stroke="Gray" StrokeThickness="2"
|
||
|
Fill="Lime" />
|
||
|
</Grid>
|
||
|
<ControlTemplate.Triggers>
|
||
|
<Trigger Property="IsChecked" Value="True">
|
||
|
<Setter Property="Visibility" TargetName="Highlight" Value="Visible"/>
|
||
|
</Trigger>
|
||
|
<Trigger Property="IsChecked" Value="False">
|
||
|
<Setter Property="Visibility" TargetName="Highlight" Value="Collapsed"/>
|
||
|
</Trigger>
|
||
|
<Trigger Property="IsMouseOver" Value="False">
|
||
|
<Setter Property="Opacity" TargetName="Highlight" Value="1"/>
|
||
|
</Trigger>
|
||
|
</ControlTemplate.Triggers>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
</Style>
|
||
|
|
||
|
<Style x:Key="Sepcial_ListBoxItem" TargetType="{x:Type ListBoxItem}">
|
||
|
<Setter Property="Background" Value="Transparent"/>
|
||
|
<Setter Property="Margin" Value="0"/>
|
||
|
<Setter Property="Padding" Value="0"/>
|
||
|
<Setter Property="BorderThickness" Value="0"/>
|
||
|
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||
|
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||
|
<Border x:Name="Bd" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
|
||
|
<Grid>
|
||
|
<Border x:Name="Highlight" BorderBrush="Black" BorderThickness="0" Background="{DynamicResource Listview_BG_Highlight}" Opacity="0"/>
|
||
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Cursor="Hand" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||
|
</Grid>
|
||
|
</Border>
|
||
|
<ControlTemplate.Triggers>
|
||
|
<Trigger Property="IsSelected" Value="true">
|
||
|
<Setter Property="Opacity" TargetName="Highlight" Value="1"/>
|
||
|
<Setter Property="BorderThickness" TargetName="Highlight" Value="1"/>
|
||
|
<Setter Property="Foreground" Value="{DynamicResource FG_White}"/>
|
||
|
<Setter Property="Margin" TargetName="Highlight" Value="0,0,1,1"/>
|
||
|
</Trigger>
|
||
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
<Setter Property="Opacity" TargetName="Highlight" Value="0.8"/>
|
||
|
</Trigger>
|
||
|
<Trigger Property="IsEnabled" Value="false">
|
||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
|
||
|
</Trigger>
|
||
|
</ControlTemplate.Triggers>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
<Style.Triggers>
|
||
|
<Trigger Property="ListBox.AlternationIndex" Value="0">
|
||
|
<Setter Property="Background" Value="{DynamicResource Listview_BG_First}"/>
|
||
|
</Trigger>
|
||
|
<Trigger Property="ListBox.AlternationIndex" Value="1">
|
||
|
<Setter Property="Background" Value="{DynamicResource Listview_BG_Second}"/>
|
||
|
</Trigger>
|
||
|
</Style.Triggers>
|
||
|
</Style>
|
||
|
<DataTemplate x:Key="DOTemplate">
|
||
|
<Grid Margin="-1,-1,0,0" Height="45" Background="{Binding IsChecked, ElementName=ckHold, Converter={StaticResource BoolBackgroundConverter}}">
|
||
|
<Grid.ColumnDefinitions>
|
||
|
|
||
|
<ColumnDefinition Width="200"></ColumnDefinition>
|
||
|
<ColumnDefinition Width="200"></ColumnDefinition>
|
||
|
<ColumnDefinition Width="45"></ColumnDefinition>
|
||
|
<ColumnDefinition Width="100"></ColumnDefinition>
|
||
|
<ColumnDefinition Width="100"></ColumnDefinition>
|
||
|
<ColumnDefinition Width="15"></ColumnDefinition>
|
||
|
</Grid.ColumnDefinitions>
|
||
|
|
||
|
<Border Grid.Column="0" BorderBrush="{DynamicResource DataGrid_Cell_BD}" BorderThickness="0,1,1,1" Padding="5,1" >
|
||
|
<TextBlock Text= "{Binding Path=Name}" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
|
||
|
</Border>
|
||
|
<Border Grid.Column="1" BorderBrush="{DynamicResource DataGrid_Cell_BD}" BorderThickness="0,1,1,1" Padding="5,1" >
|
||
|
<TextBlock Text= "{Binding Path=Address}" HorizontalAlignment="Left" VerticalAlignment="Center" ></TextBlock>
|
||
|
</Border>
|
||
|
<Border Grid.Column="2" BorderBrush="{DynamicResource DataGrid_Cell_BD}" BorderThickness="0,1,1,1" Padding="5,1">
|
||
|
<connections:IoButton ON="{Binding Path=IsConnected}" Style="{StaticResource Lamp-Button}" IsChecked="{Binding IsConnected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||
|
</Border>
|
||
|
|
||
|
<Border Grid.Column="3" BorderBrush="{DynamicResource DataGrid_Cell_BD}" BorderThickness="0,1,1,1" Padding="5,1">
|
||
|
<Button Content="Connect" Height="35" Command="{Binding RelativeSource={RelativeSource FindAncestor,
|
||
|
AncestorType={x:Type ListBox}}, Path=DataContext.ConnectCommand}" CommandParameter="{Binding Path=Name}" />
|
||
|
</Border>
|
||
|
|
||
|
|
||
|
<Border Grid.Column="4" BorderBrush="{DynamicResource DataGrid_Cell_BD}" BorderThickness="0,1,1,1" Padding="5,1">
|
||
|
<Button Content="Disconnect" Height="35" Command="{Binding RelativeSource={RelativeSource FindAncestor,
|
||
|
AncestorType={x:Type ListBox}}, Path=DataContext.DisconnectCommand}" CommandParameter="{Binding Path=Name}" />
|
||
|
</Border>
|
||
|
</Grid>
|
||
|
</DataTemplate>
|
||
|
|
||
|
|
||
|
</UserControl.Resources>
|
||
|
<Grid>
|
||
|
<ListBox ItemContainerStyle="{DynamicResource Sepcial_ListBoxItem}" Width="1900" ItemsSource="{Binding ListConnections}" AlternationCount="2" ItemTemplate="{StaticResource DOTemplate}" ScrollViewer.VerticalScrollBarVisibility="Disabled" BorderThickness="0" Margin="5,0" HorizontalAlignment="Center">
|
||
|
<ListBox.ItemsPanel>
|
||
|
<ItemsPanelTemplate>
|
||
|
<WrapPanel IsItemsHost="True" Orientation="Vertical" Margin="1,1,0,0"/>
|
||
|
</ItemsPanelTemplate>
|
||
|
</ListBox.ItemsPanel>
|
||
|
</ListBox>
|
||
|
|
||
|
</Grid>
|
||
|
</UserControl>
|