Kaynağa Gözat

自定义控件

样式分支
pry 2 yıl önce
ebeveyn
işleme
b9ab2cd0cb
12 değiştirilmiş dosya ile 3003 ekleme ve 1381 silme
  1. +4
    -0
      BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml
  2. +1698
    -968
      BPASmartClient.CustomResource/Themes/GenricStyle.xaml
  3. +578
    -389
      BPASmartClient.CustomResource/Themes/MyStyle.xaml
  4. +16
    -12
      BPASmartClient.CustomResource/UserControls/IcoButton.xaml
  5. +20
    -0
      BPASmartClient.CustomResource/UserControls/Quadrilateral.xaml
  6. +96
    -0
      BPASmartClient.CustomResource/UserControls/Quadrilateral.xaml.cs
  7. +27
    -0
      BPASmartClient.CustomResource/UserControls/TitleTextBlock.xaml
  8. +38
    -0
      BPASmartClient.CustomResource/UserControls/TitleTextBlock.xaml.cs
  9. +0
    -2
      BPASmartClient.MorkS/Control.cs
  10. +13
    -0
      BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs
  11. +2
    -0
      BPASmartClient/App.xaml
  12. +511
    -10
      BPASmartClient/Control/ShopDeviceConfigView.xaml

+ 4
- 0
BPASmartClient.CustomResource/RecDictionarys/GlobalStyle.xaml Dosyayı Görüntüle

@@ -0,0 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- 文本框的字体颜色 -->
<SolidColorBrush x:Key="TextBlockForeground" Color="#9934F7F7" />
</ResourceDictionary>

+ 1698
- 968
BPASmartClient.CustomResource/Themes/GenricStyle.xaml
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 578
- 389
BPASmartClient.CustomResource/Themes/MyStyle.xaml
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 16
- 12
BPASmartClient.CustomResource/UserControls/IcoButton.xaml Dosyayı Görüntüle

@@ -55,6 +55,7 @@


<Grid>
<!--<Canvas Width="auto" Height="auto">-->
<Button Name="a">
<Button.Style>
<Style TargetType="Button">
@@ -63,21 +64,23 @@
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
FontFamily="../Fonts/#iconfont"
Text="{Binding IcoText}" />
Margin="0,0,5,0"
FontFamily="../Fonts/#iconfont"
Text="我是图标" />
<ContentControl
Margin="10,0,5,0"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
Margin="10,0,5,0"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
@@ -96,5 +99,6 @@
</Style>
</Button.Style>
</Button>
<!--</Canvas>-->
</Grid>
</UserControl>

+ 20
- 0
BPASmartClient.CustomResource/UserControls/Quadrilateral.xaml Dosyayı Görüntüle

@@ -0,0 +1,20 @@
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.Quadrilateral"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="30"
d:DesignWidth="100"
mc:Ignorable="d">
<Grid>
<Canvas
Name="canvas"
Width="auto"
Height="auto"
SizeChanged="Canvas_SizeChanged">
<Polygon x:Name="poly" />
</Canvas>
</Grid>
</UserControl>

+ 96
- 0
BPASmartClient.CustomResource/UserControls/Quadrilateral.xaml.cs Dosyayı Görüntüle

@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// Quadrilateral.xaml 的交互逻辑
/// </summary>
public partial class Quadrilateral : UserControl
{
public Quadrilateral()
{
InitializeComponent();
}


public static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as Quadrilateral).Refresh();
}

/// <summary>
/// 依赖属性更改的委托
/// </summary>
private void Refresh()
{
this.poly.Fill = FillColor;
this.poly.StrokeThickness = StrokeThickness;
this.poly.Stroke = Stroke;
}

#region FillColor:填充颜色 依赖属性
/// <summary>
/// 填充颜色
/// </summary>
public Brush FillColor
{
get { return (Brush)GetValue(FillColorProperty); }
set { SetValue(FillColorProperty, value); }
}
public static readonly DependencyProperty FillColorProperty =
DependencyProperty.Register("FillColor", typeof(Brush), typeof(Quadrilateral),
new PropertyMetadata(default(Brush), new PropertyChangedCallback(OnPropertyChanged)));
#endregion

#region 外边线宽度
/// <summary>
/// 外边线宽度
/// </summary>
public int StrokeThickness
{
get { return (int)GetValue(StrokeThicknessProperty); }
set { SetValue(StrokeThicknessProperty, value); }
}
public static readonly DependencyProperty StrokeThicknessProperty =
DependencyProperty.Register("StrokeThickness", typeof(int), typeof(Quadrilateral),
new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));
#endregion

#region 外边框颜色
/// <summary>
/// 外边框颜色
/// </summary>
public Brush Stroke
{
get { return (Brush)GetValue(StrokeProperty); }
set { SetValue(StrokeProperty, value); }
}
public static readonly DependencyProperty StrokeProperty =
DependencyProperty.Register("Stroke", typeof(Brush), typeof(Quadrilateral),
new PropertyMetadata(default(Brush), new PropertyChangedCallback(OnPropertyChanged)));
#endregion

private void Canvas_SizeChanged(object sender, SizeChangedEventArgs e)
{
PointCollection points = new PointCollection();
points.Add(new Point(0, 0));
points.Add(new Point(e.NewSize.Width - (e.NewSize.Height / 2), 0));
points.Add(new Point(e.NewSize.Width, e.NewSize.Height));
points.Add(new Point(e.NewSize.Height / 2, e.NewSize.Height));
this.poly.Points = points;
}
}
}

+ 27
- 0
BPASmartClient.CustomResource/UserControls/TitleTextBlock.xaml Dosyayı Görüntüle

@@ -0,0 +1,27 @@
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.TitleTextBlock"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="30"
d:DesignWidth="100"
mc:Ignorable="d">
<Grid>
<Canvas
Name="canvas"
Width="auto"
Height="auto"
SizeChanged="Canvas_SizeChanged">
<Polygon x:Name="poly">
<Polygon.Fill>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Color="#ff1247EC" />
<GradientStop Offset="1" Color="#111247EC" />
</LinearGradientBrush>
</Polygon.Fill>
</Polygon>
</Canvas>
</Grid>
</UserControl>

+ 38
- 0
BPASmartClient.CustomResource/UserControls/TitleTextBlock.xaml.cs Dosyayı Görüntüle

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// TitleTextBlock.xaml 的交互逻辑
/// </summary>
public partial class TitleTextBlock : UserControl
{
public TitleTextBlock()
{
InitializeComponent();
}

private void Canvas_SizeChanged(object sender, SizeChangedEventArgs e)
{
PointCollection points = new PointCollection();
points.Add(new Point(0, 0));
points.Add(new Point(e.NewSize.Width - (e.NewSize.Height / 2), 0));
points.Add(new Point(e.NewSize.Width, e.NewSize.Height));
points.Add(new Point(0, e.NewSize.Height));
this.poly.Points = points;
}
}
}

+ 0
- 2
BPASmartClient.MorkS/Control.cs Dosyayı Görüntüle

@@ -107,10 +107,8 @@ namespace BPASmartClient.MorkS
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{

var bools = (bool[])peripheralStatus["M0.3"];
mORKS.RobotTakeNoodle = bools[0];
mORKS.RobotTakeNoodle = bools[0];
mORKS.RobotOutMeal = bools[1];
mORKS.MoveTurntable = bools[2];



+ 13
- 0
BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs Dosyayı Görüntüle

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.ViewModel
{
public class ShopDeviceConfigViewModel : ObservableObject
{
}
}

+ 2
- 0
BPASmartClient/App.xaml Dosyayı Görüntüle

@@ -10,6 +10,8 @@

<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecCheckBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml"/>
<!--<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>-->



+ 511
- 10
BPASmartClient/Control/ShopDeviceConfigView.xaml Dosyayı Görüntüle

@@ -1,12 +1,513 @@
<UserControl x:Class="BPASmartClient.Control.ShopDeviceConfigView"
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:BPASmartClient.Control"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<UserControl
x:Class="BPASmartClient.Control.ShopDeviceConfigView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:ShopDeviceConfigViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="#FFDE7889" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
<pry:Quadrilateral
x:Name="poly"
Stroke="#FFDE7889"
StrokeThickness="2" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="poly" Property="FillColor" Value="#22DE7889" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="35" />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">

<TextBlock Style="{StaticResource TextBlockStyle}" Text="请选择店铺:" />

<ComboBox
Width="150"
Margin="0,0,20,0"
VerticalAlignment="Center"
BorderBrush="#FF23CACA"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
ItemsSource="{Binding ClientDevices}"
SelectedIndex="0"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding ClientDeviceType}" />


<pry:IcoButton
Width="100"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="新建"
Foreground="{StaticResource TextBlockForeground}"
IcoText="&#xe626;" />

<!--<Button
Width="140"
Margin="0,0,20,0"
Background="#FF19B7EC"
Command="{Binding NewConnectCommand}"
Content="新建连接"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource NewButtonTemp}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>-->

<!--<Button
Width="140"
Command="{Binding SaveConnectSetCommand}"
Content="保存"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource SaveButtonTemp}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>-->
</StackPanel>

<ScrollViewer
Grid.Row="1"
Margin="0,10,0,0"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding communicationSets}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="0,0,0,30">
<Grid.RowDefinitions>
<RowDefinition Height="0.1*" />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 标题显示及操作-->
<Grid Margin="0,0,0,20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<pry:TitleTextBlock />

<TextBlock
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="楷体"
FontSize="20"
Foreground="Aqua"
Text="{Binding DeviceName}" />
</Grid>
<!--#endregion-->

<!--#region 西门子设备-->
<Grid Grid.Row="1" Visibility="{Binding Path=deviceType, Converter={StaticResource VisibleConvert}, ConverterParameter=Siemens}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.2*" />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="20" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource TextBlockStyle}"
Text="IP地址:" />
<TextBox
Grid.Column="1"
Margin="0,0,20,0"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Path=Device.IP}" />

<TextBlock
Grid.Column="2"
Style="{StaticResource TextBlockStyle}"
Text="端口号:" />
<TextBox
Grid.Column="3"
Margin="0,0,20,0"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Path=Device.PortNum}" />

<TextBlock
Grid.Column="4"
Style="{StaticResource TextBlockStyle}"
Text="PLC类型:" />
<ComboBox
Grid.Column="5"
Margin="0,0,20,0"
VerticalAlignment="Center"
BorderBrush="#FF23CACA"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
ItemsSource="{Binding Path=Device.PlcTypes}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding Path=Device.PlcType}" />

<Button
Grid.Column="7"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding DeviceName}"
Content="删除"
FontFamily="楷体"
FontSize="20"
Foreground="#FFDE7889"
Template="{StaticResource ButtonTemplate}" />

<TextBlock
Grid.Row="2"
Style="{StaticResource TextBlockStyle}"
Text="机架号:" />
<TextBox
Grid.Row="2"
Grid.Column="1"
Margin="0,0,20,0"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Path=Device.Rack}" />

<TextBlock
Grid.Row="2"
Grid.Column="2"
Style="{StaticResource TextBlockStyle}"
Text="插槽号:" />
<TextBox
Grid.Row="2"
Grid.Column="3"
Margin="0,0,20,0"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Path=Device.Slot}" />

<CheckBox
Grid.Row="2"
Grid.Column="7"
Width="100"
Height="20"
Margin="10"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="IsActive"
FontSize="16"
Foreground="#ddd"
IsChecked="{Binding IsActive}"
Template="{StaticResource CbTemplate}" />
</Grid>
</Grid>
<!--#endregion-->

<!--#region Modbus Tcp 设备-->

<Grid Grid.Row="2" Visibility="{Binding Path=deviceType, Converter={StaticResource VisibleConvert}, ConverterParameter=TCP}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.2*" />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="20" />
<RowDefinition />
</Grid.RowDefinitions>


<TextBlock
Grid.Column="0"
Style="{StaticResource TextBlockStyle}"
Text="IP地址:" />
<TextBox
Grid.Column="1"
Margin="0,0,20,0"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Path=Device.IP}" />

<TextBlock
Grid.Column="2"
Style="{StaticResource TextBlockStyle}"
Text="端口号:" />
<TextBox
Grid.Column="3"
Margin="0,0,20,0"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Path=Device.PortNum}" />

<TextBlock
Grid.Column="4"
Style="{StaticResource TextBlockStyle}"
Text="站号:" />
<TextBox
Grid.Column="5"
Margin="0,0,20,0"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Path=Device.StationNo}" />

<Button
Grid.Column="7"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding DeviceName}"
Content="删除"
FontFamily="楷体"
FontSize="20"
Foreground="#FFDE7889"
Template="{StaticResource ButtonTemplate}" />

<CheckBox
Grid.Row="2"
Grid.Column="7"
Width="100"
Height="20"
Margin="10"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="IsActive"
FontSize="16"
Foreground="#ddd"
IsChecked="{Binding IsActive}"
Template="{StaticResource CbTemplate}" />

</Grid>
</Grid>

<!--#endregion-->

<!--#region Modbus RTU 设备-->

<Grid Grid.Row="3" Visibility="{Binding Path=deviceType, Converter={StaticResource VisibleConvert}, ConverterParameter=Serial}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.2*" />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="20" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock Style="{StaticResource TextBlockStyle}" Text="端口号:" />
<ComboBox
Grid.Column="1"
Margin="0,0,20,0"
VerticalAlignment="Center"
BorderBrush="#FF23CACA"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
ItemsSource="{Binding DataContext.Ports, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding Path=Device.ComSerialPort, Mode=TwoWay}" />

<TextBlock
Grid.Column="2"
Style="{StaticResource TextBlockStyle}"
Text="波特率:" />
<ComboBox
Grid.Column="3"
Margin="0,0,20,0"
VerticalAlignment="Center"
BorderBrush="#FF23CACA"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
ItemsSource="{Binding DataContext.BaudRates, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding Path=Device.BaudRate, Mode=TwoWay}" />


<TextBlock
Grid.Column="4"
Style="{StaticResource TextBlockStyle}"
Text="奇偶:" />
<ComboBox
Grid.Column="5"
Margin="0,0,20,0"
VerticalAlignment="Center"
BorderBrush="#FF23CACA"
BorderThickness="1"
FontFamily="楷体"
FontSize="20"
Foreground="#ff23caca"
IsEditable="False"
ItemsSource="{Binding DataContext.Paritys, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
Style="{StaticResource ComboBoxStyle}"
Text="{Binding Path=Device.Parity, Mode=TwoWay}" />

<TextBlock
Grid.Row="2"
Grid.Column="0"
Style="{StaticResource TextBlockStyle}"
Text="数据位:" />
<TextBox
Grid.Row="2"
Grid.Column="1"
Margin="0,0,20,0"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Path=Device.DataBit}" />
<TextBlock
Grid.Row="2"
Grid.Column="2"
Style="{StaticResource TextBlockStyle}"
Text="停止位:" />
<TextBox
Grid.Row="2"
Grid.Column="3"
Margin="0,0,20,0"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Path=Device.StopBit}" />

<TextBlock
Grid.Row="2"
Grid.Column="4"
Style="{StaticResource TextBlockStyle}"
Text="站号:" />
<TextBox
Grid.Row="2"
Grid.Column="5"
Margin="0,0,20,0"
Style="{StaticResource TextBoxStyle}"
Text="{Binding Path=Device.StationNo}" />

<Button
Grid.Column="7"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
CommandParameter="{Binding DeviceName}"
Content="删除"
FontFamily="楷体"
FontSize="20"
Foreground="#FFDE7889"
Template="{StaticResource ButtonTemplate}" />

<CheckBox
Grid.Row="2"
Grid.Column="7"
Width="100"
Height="20"
Margin="10"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="IsActive"
FontSize="16"
Foreground="#ddd"
IsChecked="{Binding IsActive}"
Template="{StaticResource CbTemplate}" />
</Grid>
</Grid>

<!--#endregion-->

</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</ScrollViewer>
</Grid>

</UserControl>

Yükleniyor…
İptal
Kaydet