@@ -9,11 +9,12 @@ | |||
Foreground="#FF00EDFF" | |||
BorderBrush="Transparent" | |||
BorderThickness="4" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
d:DesignHeight="800" d:DesignWidth="800"> | |||
<Ellipse Tag="Ellipse" | |||
Fill="{Binding ElementName=root,Path=BJColor,Mode=TwoWay}" | |||
Stroke="{Binding ElementName=root,Path=Foreground}" | |||
StrokeThickness="{Binding ElementName=root,Path=BorderThickness}" | |||
StrokeThickness="{Binding ElementName=root,Path=BKThickness}" | |||
StrokeDashArray="{Binding ElementName=root,Path=DoubleArray,Mode=TwoWay}" | |||
> | |||
</Ellipse> | |||
@@ -1,6 +1,7 @@ | |||
using BPASmartClient.Compiler; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -70,14 +71,15 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
Width = 80; | |||
Height = 80; | |||
} | |||
BKStrokeDashArray.CollectionChanged += BKStrokeDashArray_CollectionChanged; | |||
} | |||
public bool IsCheckedColor | |||
private void BKStrokeDashArray_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) | |||
{ | |||
get { return (bool)GetValue(IsCheckedProperty); } | |||
set { SetValue(IsCheckedProperty, value); } | |||
Refresh(); | |||
} | |||
public static readonly DependencyProperty IsCheckedProperty = | |||
DependencyProperty.Register("IsChecked", typeof(bool), typeof(TheEllipse), new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |||
public Brush BJColor | |||
{ | |||
get { return (Brush)GetValue(BJColorProperty); } | |||
@@ -85,16 +87,36 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
} | |||
public static readonly DependencyProperty BJColorProperty = | |||
DependencyProperty.Register("BJColor", typeof(Brush), typeof(TheEllipse), new PropertyMetadata(new SolidColorBrush(Colors.Transparent))); | |||
public double BKThickness | |||
{ | |||
get { return (double)GetValue(BKThicknessProperty); } | |||
set { SetValue(BKThicknessProperty, value); } | |||
} | |||
public static readonly DependencyProperty BKThicknessProperty = | |||
DependencyProperty.Register("BKThickness", typeof(double), typeof(TheEllipse), new PropertyMetadata(1.0)); | |||
public ObservableCollection<double> BKStrokeDashArray | |||
{ | |||
get { return (ObservableCollection<double>)GetValue(BKStrokeDashArrayProperty); } | |||
set { SetValue(BKStrokeDashArrayProperty, value); } | |||
} | |||
public static readonly DependencyProperty BKStrokeDashArrayProperty = | |||
DependencyProperty.Register("BKStrokeDashArray", typeof(ObservableCollection<double>), typeof(TheEllipse), new PropertyMetadata(new ObservableCollection<double>(),new PropertyChangedCallback(OnPropertyChanged))); | |||
public DoubleCollection DoubleArray | |||
{ | |||
get { return (DoubleCollection)GetValue(DoubleArrayProperty); } | |||
set { SetValue(DoubleArrayProperty, value); } | |||
} | |||
public static readonly DependencyProperty DoubleArrayProperty = | |||
DependencyProperty.Register("DoubleArray", typeof(DoubleCollection), typeof(TheEllipse), new PropertyMetadata(new DoubleCollection())); | |||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||
{ | |||
(d as TheEllipse)?.Refresh(); | |||
} | |||
private void Refresh() | |||
{ | |||
//if (LeftTog != null) | |||
//{ | |||
// LeftTog.Fill = IsCheckedColor ? new SolidColorBrush(Colors.Transparent) : this.Foreground; | |||
//} | |||
DoubleArray = new DoubleCollection(BKStrokeDashArray); | |||
} | |||
public event EventHandler PropertyChange; //声明一个事件 | |||
public string ControlType => "控件"; | |||
@@ -11,10 +11,12 @@ | |||
BorderThickness="4" | |||
Tag="10" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<Border Tag="border" | |||
Background="{Binding ElementName=root,Path=BJColor,Mode=TwoWay}" | |||
BorderBrush="{Binding ElementName=root,Path=Foreground}" | |||
BorderThickness="{Binding ElementName=root,Path=BorderThickness}" | |||
CornerRadius="{Binding ElementName=root,Path=Tag}" | |||
/> | |||
<Rectangle Tag="border" | |||
Fill="{Binding ElementName=root,Path=BJColor,Mode=TwoWay}" | |||
Stroke="{Binding ElementName=root,Path=Foreground}" | |||
StrokeThickness="{Binding ElementName=root,Path=BKThickness}" | |||
StrokeDashArray="{Binding ElementName=root,Path=DoubleArray,Mode=TwoWay}" | |||
> | |||
</Rectangle> | |||
</UserControl> |
@@ -1,6 +1,7 @@ | |||
using BPASmartClient.Compiler; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -70,24 +71,20 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
Width = 80; | |||
Height = 80; | |||
} | |||
BKStrokeDashArray.CollectionChanged += BKStrokeDashArray_CollectionChanged; | |||
} | |||
public bool IsCheckedColor | |||
private void BKStrokeDashArray_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) | |||
{ | |||
get { return (bool)GetValue(IsCheckedProperty); } | |||
set { SetValue(IsCheckedProperty, value); } | |||
Refresh(); | |||
} | |||
public static readonly DependencyProperty IsCheckedProperty = | |||
DependencyProperty.Register("IsChecked", typeof(bool), typeof(TheRectangle), new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged))); | |||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |||
{ | |||
(d as TheRectangle)?.Refresh(); | |||
} | |||
private void Refresh() | |||
{ | |||
if (LeftTog != null) | |||
{ | |||
LeftTog.Background = IsCheckedColor ? new SolidColorBrush(Colors.Transparent) : this.Foreground; | |||
} | |||
DoubleArray = new DoubleCollection(BKStrokeDashArray); | |||
} | |||
public Brush BJColor | |||
@@ -97,6 +94,28 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
} | |||
public static readonly DependencyProperty BJColorProperty = | |||
DependencyProperty.Register("BJColor", typeof(Brush), typeof(TheRectangle), new PropertyMetadata(new SolidColorBrush(Colors.Transparent))); | |||
public double BKThickness | |||
{ | |||
get { return (double)GetValue(BKThicknessProperty); } | |||
set { SetValue(BKThicknessProperty, value); } | |||
} | |||
public static readonly DependencyProperty BKThicknessProperty = | |||
DependencyProperty.Register("BKThickness", typeof(double), typeof(TheRectangle), new PropertyMetadata(1.0)); | |||
public ObservableCollection<double> BKStrokeDashArray | |||
{ | |||
get { return (ObservableCollection<double>)GetValue(BKStrokeDashArrayProperty); } | |||
set { SetValue(BKStrokeDashArrayProperty, value); } | |||
} | |||
public static readonly DependencyProperty BKStrokeDashArrayProperty = | |||
DependencyProperty.Register("BKStrokeDashArray", typeof(ObservableCollection<double>), typeof(TheRectangle), new PropertyMetadata(new ObservableCollection<double>(), new PropertyChangedCallback(OnPropertyChanged))); | |||
public DoubleCollection DoubleArray | |||
{ | |||
get { return (DoubleCollection)GetValue(DoubleArrayProperty); } | |||
set { SetValue(DoubleArrayProperty, value); } | |||
} | |||
public static readonly DependencyProperty DoubleArrayProperty = | |||
DependencyProperty.Register("DoubleArray", typeof(DoubleCollection), typeof(TheRectangle), new PropertyMetadata(new DoubleCollection())); | |||
public event EventHandler PropertyChange; //声明一个事件 | |||
public string ControlType => "控件"; | |||
private bool isExecuteState; | |||
@@ -296,7 +296,10 @@ | |||
<mypro:PropertyDefinition DisplayName="前景色" Category="颜色设置" Name="Foreground"/> | |||
<mypro:PropertyDefinition DisplayName="背景色" Category="颜色设置" Name="Background"/> | |||
<mypro:PropertyDefinition DisplayName="填充颜色" Category="颜色设置" Name="BJColor"/> | |||
<mypro:PropertyDefinition DisplayName="边框宽度" Category="基本属性" Name="BKThickness"/> | |||
<mypro:PropertyDefinition DisplayName="虚线绘制" Category="基本属性" Name="BKStrokeDashArray"/> | |||
<mypro:PropertyDefinition DisplayName="边框色" Category="颜色设置" Name="BorderBrush"/> | |||
<mypro:PropertyDefinition DisplayName="填充" Category="基本属性" DisplayOrder="5" Name="WaveFill"/> | |||
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="WaveThickness"/> | |||
@@ -371,6 +371,11 @@ | |||
<Setter TargetName="txt" Property="Text" Value="圆形" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding Name}" Value="TheWuLiaoControl"> | |||
<Setter TargetName="icon" Property="Kind" Value="AlphaGCircleOutline" /> | |||
<Setter TargetName="txt" Property="Text" Value="物料集合控件" /> | |||
</DataTrigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||