58 lines
2.6 KiB
C#
58 lines
2.6 KiB
C#
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 MainShell.Resources.CustomControl
|
|
{
|
|
/// <summary>
|
|
/// LightControl.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class LightControl : UserControl
|
|
{
|
|
public LightControl()
|
|
{
|
|
InitializeComponent();
|
|
|
|
}
|
|
public static readonly DependencyProperty HeaderProperty =
|
|
DependencyProperty.Register(nameof(Header), typeof(string), typeof(LightControl), new FrameworkPropertyMetadata("通道",FrameworkPropertyMetadataOptions.AffectsRender));
|
|
|
|
public static readonly DependencyProperty ValueProperty =
|
|
DependencyProperty.Register(nameof(Value), typeof(int), typeof(LightControl), new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
|
|
|
|
public static readonly DependencyProperty EnabledProperty =
|
|
DependencyProperty.Register(nameof(Enabled), typeof(bool), typeof(LightControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
|
|
|
|
public static readonly DependencyProperty MinProperty =
|
|
DependencyProperty.Register(nameof(Min), typeof(int), typeof(LightControl), new PropertyMetadata(0));
|
|
|
|
public static readonly DependencyProperty MaxProperty =
|
|
DependencyProperty.Register(nameof(Max), typeof(int), typeof(LightControl), new PropertyMetadata(255));
|
|
|
|
public static readonly DependencyProperty TickProperty =
|
|
DependencyProperty.Register(nameof(Tick), typeof(double), typeof(LightControl), new PropertyMetadata(1d));
|
|
|
|
|
|
|
|
public string Header { get => (string)GetValue(HeaderProperty); set => SetValue(HeaderProperty, value); }
|
|
public int Value { get => (int)GetValue(ValueProperty); set => SetValue(ValueProperty, value); }
|
|
public bool Enabled { get => (bool)GetValue(EnabledProperty); set => SetValue(EnabledProperty, value); }
|
|
public int Min { get => (int)GetValue(MinProperty); set => SetValue(MinProperty, value); }
|
|
public int Max { get => (int)GetValue(MaxProperty); set => SetValue(MaxProperty, value); }
|
|
public double Tick { get => (double)GetValue(TickProperty); set => SetValue(TickProperty, value); }
|
|
|
|
|
|
}
|
|
}
|