using System.Windows; using System.Windows.Controls; namespace Aitex.Sorter.UI.Controls.Common { /// /// LED.xaml 的交互逻辑 /// public partial class LED : UserControl { public LED() { InitializeComponent(); root.DataContext = this; } public bool On { get { return (bool)GetValue(OnProperty); } set { SetValue(OnProperty, value); } } // Using a DependencyProperty as the backing store for On. This enables animation, styling, binding, etc... public static readonly DependencyProperty OnProperty = DependencyProperty.Register("On", typeof(bool), typeof(LED), new PropertyMetadata(false)); public bool IsRed { get { return (bool)GetValue(IsRedProperty); } set { SetValue(IsRedProperty, value); } } // Using a DependencyProperty as the backing store for IsRed. This enables animation, styling, binding, etc... public static readonly DependencyProperty IsRedProperty = DependencyProperty.Register("IsRed", typeof(bool), typeof(LED), new PropertyMetadata(false)); } }