private static void RowCountPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { BoardDataGrid bdg = d as BoardDataGrid; int newCount = (int)e.NewValue; int currnentCount = bdg.ContentGrid.RowDefinitions.Count; if (currnentCount > newCount) { //减少 int diff = currnentCount - newCount; for (int i = 0; i < diff; i++) { bdg.ContentGrid.RowDefinitions.Remove(bdg.ContentGrid.RowDefinitions.Last()); } } else if (currnentCount < newCount) { //增加 int diff = newCount - currnentCount; for (int i = 0; i < diff; i++) { bdg.ContentGrid.RowDefinitions.Add(new RowDefinition()); } } }
private static void ColumnsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { BoardDataGrid bdg = d as BoardDataGrid; ObservableCollection <DesignerDataGridColumn> columns = e.NewValue as ObservableCollection <DesignerDataGridColumn>; bdg.InitColumns(columns); }
private static void PaggingTimeSpanPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { BoardDataGrid bdg = d as BoardDataGrid; if (bdg.PaggingTimer != null) { bdg.PaggingTimer.Interval = new TimeSpan(0, 0, 0, 0, (int)e.NewValue); } }
private static void ItemSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { BoardDataGrid bdg = d as BoardDataGrid; bdg.StartBind(); }