using System; using System.Collections.Generic; using System.Collections.ObjectModel; 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.Shapes; namespace Test.ChildWindow { /// /// WinLayOut.xaml 的交互逻辑 /// public partial class WinLayOut : Window { public WinLayOut() { InitializeComponent(); InitData(); this.DataContext = this; } private ObservableCollection m_EqNames; /// /// 设备名称 /// public ObservableCollection EqNames { get { return this.m_EqNames; } set { this.m_EqNames = value; RaiseChanged(nameof(this.EqNames)); } } private void InitData() { EqNames = new ObservableCollection(); for (int i = 0; i < 10; i++) { EqNames.Add(i.ToString()); } } } #region 通知信息 public partial class WinLayOut : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; /// /// 提交变更 /// /// 变更属性名称 protected void RaiseChanged(String propertyName = "") { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } //protected void SetPropertyValue(ref T old, T value, [CallerMemberName] string propertyName = "") //{ // old = value; // RaiseChanged(propertyName); //} } #endregion }