using System; using System.Collections.Generic; using System.ComponentModel; 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 WPFDemo { /// /// Silo.xaml 的交互逻辑 /// public partial class Silo : UserControl, INotifyPropertyChanged { public string Index { get { return (string)GetValue(IndexProperty); } set { SetValue(IndexProperty, value); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Index")); } } // Using a DependencyProperty as the backing store for Index. This enables animation, styling, binding, etc... public static readonly DependencyProperty IndexProperty = DependencyProperty.Register("Index", typeof(string), typeof(Silo), new PropertyMetadata("Unkown")); public string Caption { get { return (string)GetValue(CaptionProperty); } set { SetValue(CaptionProperty, value); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Caption")); } } // Using a DependencyProperty as the backing store for Caption. This enables animation, styling, binding, etc... public static readonly DependencyProperty CaptionProperty = DependencyProperty.Register("Caption", typeof(string), typeof(Silo), new PropertyMetadata("Null")); public Silo() { InitializeComponent(); } public event PropertyChangedEventHandler? PropertyChanged; } }