123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using FWindSoft.Wpf;
- using FWindSoft.Wpf.Controls;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Diagnostics;
- 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;
- using System.Windows.Threading;
- namespace Test.ChildWindow
- {
- /// <summary>
- /// WinChild.xaml 的交互逻辑
- /// </summary>
- public partial class WinChild : NChildWindow
- {
- public WinChild()
- {
- InitializeComponent();
- // InitData();
- this.DataContext = this;
- this.SizeChanged += WinChild_SizeChanged;
-
- }
- protected override void LoadData(LoadParameter parameter)
- {
- InitData();
- }
- private void WinChild_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- var cc = e.NewSize;
- var old = e.PreviousSize;
- if (cc.Height < old.Height || cc.Width < old.Width)
- {
- // DataGrid.Width = 100;
- //DataGrid.UpdateLayout();
-
- //Trace.Write(Border1.ActualWidth);
- //(DataGrid.Parent as UIElement).onre.UpdateLayout();
- }
- }
- 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 < 100; i++)
- {
- EqNames.Add(i.ToString());
- }
-
- }
-
- }
- #region 通知信息
- public partial class WinChild : 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
- }
|