private static void OnDataGridContextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { GroupLevelIndicatorPane self = sender as GroupLevelIndicatorPane; if (self != null) { DataGridContext dataGridContext = e.OldValue as DataGridContext; //unregister to the old contexts Collection GroupDescriptions Changed event if (dataGridContext != null) { CollectionChangedEventManager.RemoveListener(dataGridContext.Items.GroupDescriptions, self); } dataGridContext = e.NewValue as DataGridContext; //register to the new contexts Collection GroupDescriptions Changed event if (dataGridContext != null) { CollectionChangedEventManager.AddListener(dataGridContext.Items.GroupDescriptions, self); self.PrepareDefaultStyleKey(dataGridContext.DataGridControl.GetView()); } self.InvalidateMeasure(); } }
private static void OnDataItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { GroupLevelIndicatorPane self = sender as GroupLevelIndicatorPane; if ((self != null) && (e.NewValue != CustomItemContainerGenerator.NotSet)) { self.InvalidateMeasure(); } }