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