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
{
///
/// WinChild.xaml 的交互逻辑
///
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 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 < 100; i++)
{
EqNames.Add(i.ToString());
}
}
}
#region 通知信息
public partial class WinChild : 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
}