305 lines
21 KiB
Plaintext
305 lines
21 KiB
Plaintext
![]() |
<UserControl x:Class="SWS.CAD.Views.Dialog.DialogCableConnection"
|
||
|
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:i="http://schemas.microsoft.com/xaml/behaviors"
|
||
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||
|
xmlns:prism="http://prismlibrary.com/"
|
||
|
xmlns:CustomControl="clr-namespace:SWS.CAD.Views.CustomControl"
|
||
|
xmlns:cvt ="clr-namespace:SWS.CAD.Helper.Converter"
|
||
|
xmlns:local="clr-namespace:SWS.CAD.Views.Dialog"
|
||
|
xmlns:model="clr-namespace:SWS.CAD.ViewModels"
|
||
|
mc:Ignorable="d"
|
||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||
|
<prism:Dialog.WindowStyle>
|
||
|
<Style TargetType="Window">
|
||
|
<Setter Property="Width" Value="1000"/>
|
||
|
<Setter Property="Height" Value="800"/>
|
||
|
|
||
|
<Setter Property="WindowState" Value="Normal"/>
|
||
|
<Setter Property="WindowStyle" Value="None"/>
|
||
|
<!-- 无边框不能调整窗口大小 -->
|
||
|
<Setter Property="ResizeMode" Value="NoResize"/>
|
||
|
<!-- 是否显示任务栏图标 -->
|
||
|
<Setter Property="ShowInTaskbar" Value="True"/>
|
||
|
<Setter Property="Visibility" Value="Visible"/>
|
||
|
</Style>
|
||
|
</prism:Dialog.WindowStyle>
|
||
|
<UserControl.Resources>
|
||
|
<ResourceDictionary>
|
||
|
<ResourceDictionary.MergedDictionaries>
|
||
|
<ResourceDictionary Source="pack://application:,,,/SWS.CAD;component/Views/Style/CustomStyles.xaml" />
|
||
|
</ResourceDictionary.MergedDictionaries>
|
||
|
|
||
|
<cvt:ComboBoxFilterConverter x:Key="FilterConverter"/>
|
||
|
<!-- 电缆列单元格样式 -->
|
||
|
<Style x:Key="CellStyle1" TargetType="telerik:GridViewCell">
|
||
|
<!-- 默认背景色 -->
|
||
|
<Setter Property="Background" Value="#ffff00"/>
|
||
|
<!-- 当Wire为空时触发 -->
|
||
|
<Style.Triggers>
|
||
|
<DataTrigger Binding="{Binding TagNumber}" Value="{x:Null}">
|
||
|
<Setter Property="Background" Value="White"/>
|
||
|
<!-- 空值背景色 -->
|
||
|
</DataTrigger>
|
||
|
</Style.Triggers>
|
||
|
</Style>
|
||
|
|
||
|
<!-- 电芯列单元格样式 -->
|
||
|
<Style x:Key="CellStyle2" TargetType="telerik:GridViewCell">
|
||
|
<Setter Property="Background" Value="#00ff00"/>
|
||
|
<Style.Triggers>
|
||
|
<DataTrigger Binding="{Binding Set}" Value="{x:Null}">
|
||
|
<Setter Property="Background" Value="White"/>
|
||
|
</DataTrigger>
|
||
|
</Style.Triggers>
|
||
|
</Style>
|
||
|
|
||
|
<!-- 电芯列单元格样式 -->
|
||
|
<Style x:Key="CellStyle3" TargetType="telerik:GridViewCell">
|
||
|
<Setter Property="Background" Value="#15b2f7"/>
|
||
|
<Style.Triggers>
|
||
|
<DataTrigger Binding="{Binding Wire}" Value="{x:Null}">
|
||
|
<Setter Property="Background" Value="White"/>
|
||
|
</DataTrigger>
|
||
|
</Style.Triggers>
|
||
|
</Style>
|
||
|
|
||
|
<!-- 端子列单元格样式 -->
|
||
|
<Style x:Key="FoCellStyle4" TargetType="telerik:GridViewCell">
|
||
|
<Setter Property="Background" Value="White"/>
|
||
|
<Style.Triggers>
|
||
|
<DataTrigger Binding="{Binding FoIsStatusModified}" Value="true">
|
||
|
<Setter Property="Background" Value="#ff2ee2"/>
|
||
|
</DataTrigger>
|
||
|
</Style.Triggers>
|
||
|
</Style>
|
||
|
|
||
|
<Style x:Key="ToCellStyle4" TargetType="telerik:GridViewCell">
|
||
|
<Setter Property="Background" Value="White"/>
|
||
|
<Style.Triggers>
|
||
|
<DataTrigger Binding="{Binding ToIsStatusModified}" Value="true">
|
||
|
<Setter Property="Background" Value="#ff2ee2"/>
|
||
|
</DataTrigger>
|
||
|
</Style.Triggers>
|
||
|
</Style>
|
||
|
|
||
|
<!-- Button模板 -->
|
||
|
<DataTemplate x:Key="ButtonTemplate">
|
||
|
<telerik:RadButton Content="{Binding FromPanel.Value,Mode=TwoWay}" telerik:StyleManager.Theme="Office_Blue" Width="auto"
|
||
|
Tag="Fo新增端子排"
|
||
|
Command="{Binding DataContext.TableButtonCmd,RelativeSource={RelativeSource AncestorType=telerik:RadGridView}}"
|
||
|
CommandParameter="{Binding Tag,RelativeSource={RelativeSource Self}}" />
|
||
|
</DataTemplate>
|
||
|
|
||
|
<!-- ToggleSwitch模板 -->
|
||
|
<DataTemplate x:Key="RadToggleSwitchButtonTemplate">
|
||
|
<StackPanel Orientation="Horizontal">
|
||
|
<telerik:RadToggleSwitchButton CheckedContent="批量填充"
|
||
|
UncheckedContent="批量填充"
|
||
|
HorizontalAlignment="Center"
|
||
|
telerik:StyleManager.Theme="Office2019"
|
||
|
IsChecked="{Binding FoIsChecked}"/>
|
||
|
</StackPanel>
|
||
|
</DataTemplate>
|
||
|
|
||
|
<!-- 文本框模板 -->
|
||
|
<DataTemplate x:Key="TextBlockTemplate">
|
||
|
<TextBlock Text="{Binding FromPanel.Value, Mode=TwoWay}"
|
||
|
Foreground="{Binding FromPanel.Foreground, Mode=TwoWay}"
|
||
|
HorizontalAlignment="Center"/>
|
||
|
</DataTemplate>
|
||
|
<!-- 下拉框模板 -->
|
||
|
<DataTemplate x:Key="ComboBoxTemplate">
|
||
|
<ComboBox Width="120"
|
||
|
ItemsSource="{Binding FromPanel.Items ,Mode=TwoWay}"
|
||
|
SelectedItem="{Binding FromPanel.SelectItem,Mode=TwoWay}"
|
||
|
>
|
||
|
<i:Interaction.Triggers>
|
||
|
<i:EventTrigger EventName="SelectionChanged">
|
||
|
<i:InvokeCommandAction Command="{Binding DataContext.FoSelectChangedCommand,RelativeSource={RelativeSource AncestorType=telerik:RadGridView}}"
|
||
|
CommandParameter="{Binding}" />
|
||
|
</i:EventTrigger>
|
||
|
</i:Interaction.Triggers>
|
||
|
</ComboBox>
|
||
|
</DataTemplate>
|
||
|
<!-- 模板选择器 -->
|
||
|
<CustomControl:CableConnection_TemplateSelector x:Key="CableTemplateSelector"
|
||
|
ButtonTemplate="{StaticResource ButtonTemplate}"
|
||
|
RadToggleSwitchButtonTemplate="{StaticResource RadToggleSwitchButtonTemplate}"
|
||
|
TextBlockTemplate="{StaticResource TextBlockTemplate}"
|
||
|
ComboBoxTemplate="{StaticResource ComboBoxTemplate}"/>
|
||
|
|
||
|
<!-- Button模板 -->
|
||
|
<DataTemplate x:Key="ButtonTemplate2">
|
||
|
<telerik:RadButton Content="{Binding ToPanel.Value,Mode=TwoWay}" telerik:StyleManager.Theme="Office_Blue" Width="auto"
|
||
|
Tag="To新增端子排"
|
||
|
Command="{Binding DataContext.TableButtonCmd,RelativeSource={RelativeSource AncestorType=telerik:RadGridView}}"
|
||
|
CommandParameter="{Binding Tag,RelativeSource={RelativeSource Self}}" />
|
||
|
</DataTemplate>
|
||
|
|
||
|
<!-- ToggleSwitch模板 -->
|
||
|
<DataTemplate x:Key="RadToggleSwitchButtonTemplate2">
|
||
|
<StackPanel Orientation="Horizontal">
|
||
|
<telerik:RadToggleSwitchButton CheckedContent="批量填充"
|
||
|
UncheckedContent="批量填充"
|
||
|
HorizontalAlignment="Center" telerik:StyleManager.Theme="Office2019"
|
||
|
IsChecked="{Binding ToIsChecked}"/>
|
||
|
</StackPanel>
|
||
|
</DataTemplate>
|
||
|
|
||
|
<!-- 文本框模板 -->
|
||
|
<DataTemplate x:Key="TextBlockTemplate2">
|
||
|
<TextBlock Text="{Binding ToPanel.Value, Mode=TwoWay}"
|
||
|
Foreground="{Binding ToPanel.Foreground, Mode=TwoWay}"
|
||
|
HorizontalAlignment="Center"/>
|
||
|
</DataTemplate>
|
||
|
<!-- 下拉框模板 -->
|
||
|
<DataTemplate x:Key="ComboBoxTemplate2">
|
||
|
<ComboBox ItemsSource="{Binding ToPanel.Items}"
|
||
|
SelectedItem="{Binding ToPanel.SelectItem}">
|
||
|
<i:Interaction.Triggers>
|
||
|
<i:EventTrigger EventName="SelectionChanged">
|
||
|
<i:InvokeCommandAction Command="{Binding DataContext.ToSelectChangedCommand,RelativeSource={RelativeSource AncestorType=telerik:RadGridView}}"
|
||
|
CommandParameter="{Binding}" />
|
||
|
</i:EventTrigger>
|
||
|
</i:Interaction.Triggers>
|
||
|
</ComboBox>
|
||
|
</DataTemplate>
|
||
|
<!-- 模板选择器 -->
|
||
|
<CustomControl:CableConnection_TemplateSelector x:Key="CableTemplateSelector2"
|
||
|
ButtonTemplate="{StaticResource ButtonTemplate2}"
|
||
|
RadToggleSwitchButtonTemplate="{StaticResource RadToggleSwitchButtonTemplate2}"
|
||
|
TextBlockTemplate="{StaticResource TextBlockTemplate2}"
|
||
|
ComboBoxTemplate="{StaticResource ComboBoxTemplate2}"
|
||
|
/>
|
||
|
</ResourceDictionary>
|
||
|
</UserControl.Resources>
|
||
|
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
|
||
|
<Grid>
|
||
|
<StackPanel Background="#5d6b99">
|
||
|
<CustomControl:customWindowTitleBar/>
|
||
|
<Grid Margin="5">
|
||
|
<Grid.RowDefinitions>
|
||
|
<RowDefinition Height="auto" />
|
||
|
<RowDefinition Height="auto" />
|
||
|
</Grid.RowDefinitions>
|
||
|
<DockPanel Grid.Row="0" LastChildFill="False">
|
||
|
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left">
|
||
|
<TextBlock Text="图纸电缆位号:" VerticalAlignment="Center" Margin="5"/>
|
||
|
<ComboBox ItemsSource="{Binding AllTagPixels}" Margin="5" Width="120"
|
||
|
DisplayMemberPath="TagNumber"
|
||
|
SelectedItem="{Binding SelectedTagPixels}"/>
|
||
|
</StackPanel>
|
||
|
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right">
|
||
|
<telerik:RadButton Content="电缆连接" Margin="5" telerik:StyleManager.Theme="Office_Blue"
|
||
|
Command="{Binding TableButtonCmd}"
|
||
|
CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" />
|
||
|
<telerik:RadButton Content="关闭" Margin="5" telerik:StyleManager.Theme="Office_Blue"
|
||
|
Command="{Binding TableButtonCmd}"
|
||
|
CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" />
|
||
|
</StackPanel>
|
||
|
</DockPanel>
|
||
|
<Grid Grid.Row="1">
|
||
|
<telerik:RadGridView x:Name="RadGridView1" SelectionMode="Single" Width="auto" Height="450"
|
||
|
AutoGenerateColumns="False" IsFilteringAllowed="False"
|
||
|
IsReadOnly="False" RowIndicatorVisibility="Collapsed"
|
||
|
ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Blue"
|
||
|
|
||
|
ItemsSource="{Binding CableConnectionInfos}" SelectedItem="{Binding SelectCableConnectionInfo, Mode=TwoWay}"
|
||
|
>
|
||
|
<telerik:RadGridView.Columns>
|
||
|
<telerik:GridViewDataColumn Header="From的设备信息" HeaderTextAlignment="Center" Width="150" CellTemplateSelector="{StaticResource CableTemplateSelector}"/>
|
||
|
<telerik:GridViewComboBoxColumn Header="端子" Width="80" HeaderTextAlignment="Center"
|
||
|
IsReadOnlyBinding="{Binding FoTermIsRead,Mode=TwoWay}"
|
||
|
CellStyle="{StaticResource FoCellStyle4}"
|
||
|
>
|
||
|
<telerik:GridViewComboBoxColumn.CellTemplate>
|
||
|
<DataTemplate>
|
||
|
<TextBlock Text="{Binding FromPanelStripTerm}"/>
|
||
|
</DataTemplate>
|
||
|
</telerik:GridViewComboBoxColumn.CellTemplate>
|
||
|
<telerik:GridViewComboBoxColumn.CellEditTemplate>
|
||
|
<DataTemplate>
|
||
|
<telerik:RadComboBox
|
||
|
SelectedItem="{Binding FromPanelStripTerm, Mode=TwoWay}">
|
||
|
<i:Interaction.Triggers>
|
||
|
<i:EventTrigger EventName="SelectionChanged">
|
||
|
<i:InvokeCommandAction Command="{Binding DataContext.FromPanelStripTermCmd,
|
||
|
RelativeSource={RelativeSource AncestorType=telerik:RadGridView}}"
|
||
|
CommandParameter="{Binding}"/>
|
||
|
</i:EventTrigger>
|
||
|
</i:Interaction.Triggers>
|
||
|
<telerik:RadComboBox.Style>
|
||
|
<Style TargetType="telerik:RadComboBox">
|
||
|
<Setter Property="ItemsSource">
|
||
|
<Setter.Value>
|
||
|
<MultiBinding Converter="{StaticResource FilterConverter}">
|
||
|
<Binding Path="SelectedItem" RelativeSource="{RelativeSource Self}"/>
|
||
|
<Binding Source="{x:Static model:CableConnectionInfo.FoAvailableOptions}"/>
|
||
|
</MultiBinding>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
</Style>
|
||
|
</telerik:RadComboBox.Style>
|
||
|
</telerik:RadComboBox>
|
||
|
</DataTemplate>
|
||
|
</telerik:GridViewComboBoxColumn.CellEditTemplate>
|
||
|
</telerik:GridViewComboBoxColumn>
|
||
|
<telerik:GridViewDataColumn Header="电芯" Width="80" HeaderTextAlignment="Center" IsReadOnly="True"
|
||
|
DataMemberBinding="{Binding Wire}" CellStyle="{StaticResource CellStyle3}"/>
|
||
|
<telerik:GridViewDataColumn Header="电缆对" Width="80" HeaderTextAlignment="Center" IsReadOnly="True"
|
||
|
DataMemberBinding="{Binding Set}" CellStyle="{StaticResource CellStyle2}"/>
|
||
|
<telerik:GridViewDataColumn Header="电缆" Width="80" HeaderTextAlignment="Center" DataMemberBinding="{Binding TagNumber}"
|
||
|
IsCellMergingEnabled="True" IsReadOnly="True" CellStyle="{StaticResource CellStyle1}"/>
|
||
|
<telerik:GridViewDataColumn Header="电缆对" Width="80" HeaderTextAlignment="Center" IsReadOnly="True"
|
||
|
DataMemberBinding="{Binding Set}" CellStyle="{StaticResource CellStyle2}"/>
|
||
|
<telerik:GridViewDataColumn Header="电芯" Width="80" HeaderTextAlignment="Center" IsReadOnly="True"
|
||
|
DataMemberBinding="{Binding Wire}" CellStyle="{StaticResource CellStyle3}"/>
|
||
|
<telerik:GridViewComboBoxColumn Header="端子" Width="80" HeaderTextAlignment="Center"
|
||
|
IsReadOnlyBinding="{Binding ToTermIsRead ,Mode=TwoWay}"
|
||
|
CellStyle="{StaticResource ToCellStyle4}"
|
||
|
>
|
||
|
<telerik:GridViewComboBoxColumn.CellTemplate>
|
||
|
<DataTemplate>
|
||
|
<TextBlock Text="{Binding ToPanelStripTerm}"/>
|
||
|
</DataTemplate>
|
||
|
</telerik:GridViewComboBoxColumn.CellTemplate>
|
||
|
<telerik:GridViewComboBoxColumn.CellEditTemplate>
|
||
|
<DataTemplate>
|
||
|
<telerik:RadComboBox
|
||
|
SelectedItem="{Binding ToPanelStripTerm, Mode=TwoWay}">
|
||
|
<i:Interaction.Triggers>
|
||
|
<i:EventTrigger EventName="SelectionChanged">
|
||
|
<i:InvokeCommandAction Command="{Binding DataContext.ToPanelStripTermCmd,
|
||
|
RelativeSource={RelativeSource AncestorType=telerik:RadGridView}}"
|
||
|
CommandParameter="{Binding}"/>
|
||
|
</i:EventTrigger>
|
||
|
</i:Interaction.Triggers>
|
||
|
<telerik:RadComboBox.Style>
|
||
|
<Style TargetType="telerik:RadComboBox">
|
||
|
<Setter Property="ItemsSource">
|
||
|
<Setter.Value>
|
||
|
<MultiBinding Converter="{StaticResource FilterConverter}">
|
||
|
<Binding Path="FromPanelStripTerm" RelativeSource="{RelativeSource Self}"/>
|
||
|
<Binding Source="{x:Static model:CableConnectionInfo.ToAvailableOptions}"/>
|
||
|
</MultiBinding>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
</Style>
|
||
|
</telerik:RadComboBox.Style>
|
||
|
</telerik:RadComboBox>
|
||
|
</DataTemplate>
|
||
|
</telerik:GridViewComboBoxColumn.CellEditTemplate>
|
||
|
</telerik:GridViewComboBoxColumn>
|
||
|
<telerik:GridViewDataColumn Header="To的设备信息" Width="150" HeaderTextAlignment="Center" CellTemplateSelector="{StaticResource CableTemplateSelector2}"/>
|
||
|
</telerik:RadGridView.Columns>
|
||
|
</telerik:RadGridView>
|
||
|
</Grid>
|
||
|
</Grid>
|
||
|
</StackPanel>
|
||
|
</Grid>
|
||
|
</telerik:RadBusyIndicator>
|
||
|
</UserControl>
|