WinLayOut.xaml.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Shapes;
  16. namespace Test.ChildWindow
  17. {
  18. /// <summary>
  19. /// WinLayOut.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class WinLayOut : Window
  22. {
  23. public WinLayOut()
  24. {
  25. InitializeComponent();
  26. InitData();
  27. this.DataContext = this;
  28. }
  29. private ObservableCollection<string> m_EqNames;
  30. /// <summary>
  31. /// 设备名称
  32. /// </summary>
  33. public ObservableCollection<string> EqNames
  34. {
  35. get { return this.m_EqNames; }
  36. set
  37. {
  38. this.m_EqNames = value;
  39. RaiseChanged(nameof(this.EqNames));
  40. }
  41. }
  42. private void InitData()
  43. {
  44. EqNames = new ObservableCollection<string>();
  45. for (int i = 0; i < 10; i++)
  46. {
  47. EqNames.Add(i.ToString());
  48. }
  49. }
  50. }
  51. #region 通知信息
  52. public partial class WinLayOut : INotifyPropertyChanged
  53. {
  54. public event PropertyChangedEventHandler PropertyChanged;
  55. /// <summary>
  56. /// 提交变更
  57. /// </summary>
  58. /// <param name="propertyName">变更属性名称</param>
  59. protected void RaiseChanged(String propertyName = "")
  60. {
  61. if (PropertyChanged != null)
  62. {
  63. PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  64. }
  65. }
  66. //protected void SetPropertyValue<T>(ref T old, T value, [CallerMemberName] string propertyName = "")
  67. //{
  68. // old = value;
  69. // RaiseChanged(propertyName);
  70. //}
  71. }
  72. #endregion
  73. }