private static IDisposable DeferResortHelper( IEnumerable itemsSourceCollection, CollectionView collectionView, SortDescriptionCollection sortDescriptions) { IDisposable resortDisposable = null; DataGridSortDescriptionCollection dataGridSortDescriptions = sortDescriptions as DataGridSortDescriptionCollection; if (dataGridSortDescriptions != null) { // We are in a detail resortDisposable = dataGridSortDescriptions.DeferResort(); } else { Debug.Assert(collectionView != null, "We must have a CollectionView when we are not processing a Detail"); DataGridCollectionViewBase dataGridCollectionView = itemsSourceCollection as DataGridCollectionViewBase; if (dataGridCollectionView != null) { resortDisposable = dataGridCollectionView.DataGridSortDescriptions.DeferResort(); } else { resortDisposable = collectionView.DeferRefresh(); } } Debug.Assert(resortDisposable != null); return(resortDisposable); }
public DeferResortDisposable(DataGridSortDescriptionCollection parentCollection) { if (parentCollection == null) { throw new ArgumentNullException("parentCollection"); } m_parentCollection = parentCollection; m_parentCollection.m_deferResortCount++; }
protected DataGridDetailDescription() { m_itemProperties = new DataGridItemPropertyCollection(); m_detailDescriptions = new DataGridDetailDescriptionCollection(); m_defaultPropertyDescriptions = new PropertyDescriptionRouteDictionary(); m_groupDescriptions = new GroupDescriptionCollection(); m_sortDescriptions = new DataGridSortDescriptionCollection(); this.AutoCreateDetailDescriptions = true; this.AutoCreateItemProperties = true; this.DefaultCalculateDistinctValues = true; CollectionChangedEventManager.AddListener(m_itemProperties, this); InitializeItemPropertyEventManager.AddListener(m_itemProperties, this); CollectionChangedEventManager.AddListener(m_detailDescriptions, this); }
protected DataGridDetailDescription() { m_detailDescriptions = new DataGridDetailDescriptionCollection(); m_detailDescriptions.CollectionChanged += this.OnDetailDescriptionsCollectionChanged; m_itemProperties = new DataGridItemPropertyCollection(); m_itemProperties.CollectionChanged += this.OnItemPropertiesCollectionChanged; m_groupDescriptions = new GroupDescriptionCollection(); m_sortDescriptions = new DataGridSortDescriptionCollection(); m_statFunctions = new StatFunctionCollection(); m_autoFilterValues = new ReadOnlyDictionary<string, IList>(); m_autoFilteredItems = new ObservableCollection<DataGridItemPropertyBase>(); m_registeredFieldNamesToAutoFilterValues = new Dictionary<string, INotifyCollectionChanged>(); m_registeredAutoFilterValuesToFieldNames = new Dictionary<INotifyCollectionChanged, string>(); this.AutoCreateDetailDescriptions = true; this.AutoCreateItemProperties = true; this.DefaultCalculateDistinctValues = true; }
protected DataGridDetailDescription() { m_detailDescriptions = new DataGridDetailDescriptionCollection(); m_detailDescriptions.CollectionChanged += this.OnDetailDescriptionsCollectionChanged; m_itemProperties = new DataGridItemPropertyCollection(); m_itemProperties.CollectionChanged += this.OnItemPropertiesCollectionChanged; m_groupDescriptions = new GroupDescriptionCollection(); m_sortDescriptions = new DataGridSortDescriptionCollection(); m_statFunctions = new StatFunctionCollection(); m_autoFilterValues = new ReadOnlyDictionary <string, IList>(); m_autoFilteredItems = new ObservableCollection <DataGridItemPropertyBase>(); m_registeredFieldNamesToAutoFilterValues = new Dictionary <string, INotifyCollectionChanged>(); m_registeredAutoFilterValuesToFieldNames = new Dictionary <INotifyCollectionChanged, string>(); this.AutoCreateDetailDescriptions = true; this.AutoCreateItemProperties = true; this.DefaultCalculateDistinctValues = true; }
private void SynchronizeWithDetailDescription( DataGridDetailDescription detailDescription ) { if( detailDescription != m_detailDescription ) { this.DetachFromDetailDescription(); m_shouldCreateColumns = true; m_detailDescription = detailDescription; DataGridSortDescriptionCollection dataGridSortDescriptionCollection = null; if( detailDescription != null ) { //register to the collectionchanged of the DataGridDetailDescription collection of the detailDescription matching this one. dataGridSortDescriptionCollection = detailDescription.DataGridSortDescriptions; m_groupDescriptions = detailDescription.GroupDescriptions; CollectionChangedEventManager.AddListener( detailDescription.ItemProperties, this ); CollectionChangedEventManager.AddListener( detailDescription.DetailDescriptions, this ); } else { dataGridSortDescriptionCollection = new DataGridSortDescriptionCollection(); m_groupDescriptions = new GroupDescriptionCollection(); } m_sortDescriptions = dataGridSortDescriptionCollection; m_sortDescriptionsSyncContext = null; //clear it, if it was ever set! //This update is required since there might be some columns in the Columns collection after the XAML parsing of the DetailConfiguration DataGridContext.SynchronizeSortProperties( dataGridSortDescriptionCollection.SyncContext, m_sortDescriptions, this.Columns ); //This update is required since we want the GroupLevelDescriptions to be created if DetailConfiguration in XAML //contains GroupDescriptions DataGridContext.UpdateGroupLevelDescriptions( this.GroupLevelDescriptions, new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Reset ), this.GroupDescriptions, this.Columns ); CollectionChangedEventManager.AddListener( m_sortDescriptions, this ); CollectionChangedEventManager.AddListener( m_groupDescriptions, this ); if( detailDescription != null ) { if( this.ReadLocalValue( DetailConfiguration.TitleProperty ) == DependencyProperty.UnsetValue ) { if( detailDescription.Title == null ) { this.Title = detailDescription.RelationName; } else { this.Title = detailDescription.Title; } } if( ( this.ReadLocalValue( DetailConfiguration.TitleTemplateProperty ) == DependencyProperty.UnsetValue ) && ( detailDescription.TitleTemplate != null ) ) { this.TitleTemplate = detailDescription.TitleTemplate; } DetailConfiguration.SynchronizeDetailConfigurations( detailDescription.DetailDescriptions, this.DetailConfigurations, this.AutoCreateDetailConfigurations, this.AutoCreateForeignKeyConfigurations, this.AutoRemoveColumnsAndDetailConfigurations ); } } if( detailDescription != null ) { ForeignKeyConfiguration.UpdateColumnsForeignKeyConfigurationsFromDataGridCollectionView( this.Columns.FieldNameToColumnDictionary, detailDescription.ItemProperties, this.AutoCreateForeignKeyConfigurations ); } }
public DeferResortDisposable( DataGridSortDescriptionCollection parentCollection ) { if( parentCollection == null ) throw new ArgumentNullException( "parentCollection" ); m_parentCollection = parentCollection; m_parentCollection.m_deferResortCount++; }