Browse Source

1

样式分支
fyf 2 years ago
parent
commit
b68b933963
3 changed files with 18 additions and 8 deletions
  1. +9
    -3
      BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs
  2. +5
    -3
      BPASmartClient.SCADAControl/Themes/Generic.xaml
  3. +4
    -2
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml

+ 9
- 3
BPASmartClient.SCADAControl/CustomerControls/SwitchButton.cs View File

@@ -92,7 +92,13 @@ namespace BPASmartClient.SCADAControl.CustomerControls
}
private static readonly DependencyProperty DataModelProperty =
DependencyProperty.Register("DataModel", typeof(Dictionary<string, object>), typeof(SwitchButton), new PropertyMetadata(new Dictionary<string, object>()));

public Brush DKColor
{
get { return (Brush)GetValue(DKColorProperty); }
set { SetValue(DKColorProperty, value); }
}
public static readonly DependencyProperty DKColorProperty =
DependencyProperty.Register("DKColor", typeof(Brush), typeof(SwitchButton), new PropertyMetadata(new SolidColorBrush(Colors.Transparent)));
TranslateTransform transX;
Ellipse ellipse;
public override void OnApplyTemplate()
@@ -123,12 +129,12 @@ namespace BPASmartClient.SCADAControl.CustomerControls
if (IsChecked == true)
{
da.To = ActualWidth - ellipse.ActualWidth - 5;
ellipse.SetCurrentValue(Ellipse.FillProperty, Background);
ellipse.SetCurrentValue(Ellipse.FillProperty, DKColor);
}
else
{
da.To = 3;
ellipse.SetCurrentValue(Ellipse.FillProperty, Brushes.Gray);
ellipse.SetCurrentValue(Ellipse.FillProperty, Foreground);
}

transX.BeginAnimation(TranslateTransform.XProperty, da);


+ 5
- 3
BPASmartClient.SCADAControl/Themes/Generic.xaml View File

@@ -163,15 +163,17 @@
</Style>

<Style TargetType="{x:Type ctrl:SwitchButton}">
<Setter Property="Background" Value="#00F4D5" />
<Setter Property="Background" Value="{StaticResource ControlBackground}" />
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="Foreground" Value="Gray" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ctrl:SwitchButton">
<Border
Background="{StaticResource ControlBackground}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=ActualHeight, Converter={StaticResource HalfNumber}}">
<Grid>
<Ellipse


+ 4
- 2
BeDesignerSCADA/Controls/MainCanvasPanel.xaml View File

@@ -289,8 +289,9 @@
<mypro:PropertyDefinition DisplayName="填充颜色" Category="颜色设置" Name="BJColor"/>
<mypro:PropertyDefinition DisplayName="边框宽度" Category="基本属性" Name="BKThickness"/>
<mypro:PropertyDefinition DisplayName="虚线绘制" Category="基本属性" Name="BKStrokeDashArray"/>
<mypro:PropertyDefinition DisplayName="选中色" Category="颜色设置" Name="DKColor"/>


<mypro:PropertyDefinition DisplayName="边框色" Category="颜色设置" Name="BorderBrush"/>
<mypro:PropertyDefinition DisplayName="填充" Category="基本属性" DisplayOrder="5" Name="WaveFill"/>
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="WaveThickness"/>
@@ -300,6 +301,7 @@
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="StrokeThickness"/>
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="BorderThickness"/>

<mypro:PropertyDefinition DisplayName="点击事件" Category="事件绑定" DisplayOrder="0" Name="ClickExec" />
<mypro:PropertyDefinition DisplayName="值改变事件" Category="事件绑定" DisplayOrder="1" Name="ValueChangedExecute" />
<mypro:PropertyDefinition DisplayName="定时触发" Category="事件绑定" DisplayOrder="2" Name="TikcExecute" />
@@ -311,7 +313,7 @@
</mypro:PropertyGrid.PropertyDefinitions>

<mypro:PropertyGrid.EditorDefinitions>
<mypro:EditorTemplateDefinition TargetProperties="Foreground,Background,BorderBrush,WaveFill,WaveStroke,Fill,Stroke,BJColor">
<mypro:EditorTemplateDefinition TargetProperties="Foreground,Background,BorderBrush,WaveFill,WaveStroke,Fill,Stroke,BJColor,DKColor">
<mypro:EditorTemplateDefinition.EditingTemplate>
<DataTemplate>
<mypro:ColorPicker SelectedColor="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={x:Static s:ColorToStringConverter.Instance}}" />


Loading…
Cancel
Save