public override bool Equals(object obj) { GroupNamesTreeKey groupStatusKey = obj as GroupNamesTreeKey; if (groupStatusKey == null) { return(false); } if (m_cachedHash != groupStatusKey.m_cachedHash) { return(false); } int groupStatusKeyNamesTreeLength = groupStatusKey.m_namesTree.Length; if (m_namesTree.Length != groupStatusKeyNamesTreeLength) { return(false); } for (int i = 0; i < groupStatusKeyNamesTreeLength; i++) { if (!Object.Equals(m_namesTree[i], groupStatusKey.m_namesTree[i])) { return(false); } } return(true); }
protected override void RestoringVisit(DataGridContext sourceContext, CollectionViewGroup group, object[] namesTree, int groupLevel, bool isExpanded, bool isComputedExpanded) { if (sourceContext != m_rootDataGridContext) { throw new InvalidOperationException("Group does not belong to the root DataGridContext."); } if (groupLevel > m_maxGroupLevel) { return; } GroupNamesTreeKey groupNamesTreeKey = new GroupNamesTreeKey(namesTree); bool wasExpanded; if (m_groupsStateDictionary.TryGetValue(groupNamesTreeKey, out wasExpanded)) { if (wasExpanded) { sourceContext.ExpandGroup(group, true); } else { sourceContext.CollapseGroup(group, true); } } else if (m_stopAtFirstCollapsedGroup) { sourceContext.CollapseGroup(group, true); } }
public NamesTreeGroupFinderVisitor( object[] namesTree ) { if( namesTree == null ) throw new ArgumentNullException( "namesTree" ); if( namesTree.Length == 0 ) throw new ArgumentException( "namesTree should not be an empty array", "namesTree" ); m_groupNamesTreeKey = new GroupNamesTreeKey( namesTree ); }
public void Visit( DataGridContext sourceContext, System.Windows.Data.CollectionViewGroup group, object[] namesTree, int groupLevel, bool isExpanded, bool isComputedExpanded, ref bool stopVisit ) { if( this.Group == null ) { GroupNamesTreeKey currentGroupKey = new GroupNamesTreeKey( namesTree ); if( currentGroupKey.Equals( m_groupNamesTreeKey ) == true ) this.Group = group; } }
public void Visit(DataGridContext sourceContext, System.Windows.Data.CollectionViewGroup group, object[] namesTree, int groupLevel, bool isExpanded, bool isComputedExpanded, ref bool stopVisit) { if (this.Group == null) { GroupNamesTreeKey currentGroupKey = new GroupNamesTreeKey(namesTree); if (currentGroupKey.Equals(m_groupNamesTreeKey) == true) { this.Group = group; } } }
public NamesTreeGroupFinderVisitor(object[] namesTree) { if (namesTree == null) { throw new ArgumentNullException("namesTree"); } if (namesTree.Length == 0) { throw new ArgumentException("namesTree should not be an empty array", "namesTree"); } m_groupNamesTreeKey = new GroupNamesTreeKey(namesTree); }
protected override void SavingVisit(DataGridContext sourceContext, CollectionViewGroup group, object[] namesTree, int groupLevel, bool isExpanded, bool isComputedExpanded) { if (sourceContext != m_rootDataGridContext) { throw new InvalidOperationException("Group does not belong to the root DataGridContext."); } if (groupLevel > m_maxGroupLevel) { return; } if ((m_stopAtFirstCollapsedGroup) && (!isComputedExpanded)) { return; } GroupNamesTreeKey groupNamesTreeKey = new GroupNamesTreeKey(namesTree); m_groupsStateDictionary.Add(groupNamesTreeKey, isExpanded); }
protected override void RestoringVisit( DataGridContext sourceContext, CollectionViewGroup group, object[] namesTree, int groupLevel, bool isExpanded, bool isComputedExpanded ) { if( sourceContext != m_rootDataGridContext ) throw new InvalidOperationException( "Group does not belong to the root DataGridContext." ); if( groupLevel > m_maxGroupLevel ) return; GroupNamesTreeKey groupNamesTreeKey = new GroupNamesTreeKey( namesTree ); bool wasExpanded; if( m_groupsStateDictionary.TryGetValue( groupNamesTreeKey, out wasExpanded ) ) { if( wasExpanded ) { sourceContext.ExpandGroupCore( group, true ); } else { sourceContext.CollapseGroupCore( group, true ); } } else if( m_stopAtFirstCollapsedGroup ) { sourceContext.CollapseGroupCore( group, true ); } }
protected override void SavingVisit( DataGridContext sourceContext, CollectionViewGroup group, object[] namesTree, int groupLevel, bool isExpanded, bool isComputedExpanded ) { if( sourceContext != m_rootDataGridContext ) throw new InvalidOperationException( "Group does not belong to the root DataGridContext." ); if( groupLevel > m_maxGroupLevel ) return; if( ( m_stopAtFirstCollapsedGroup ) && ( !isComputedExpanded ) ) return; GroupNamesTreeKey groupNamesTreeKey = new GroupNamesTreeKey( namesTree ); m_groupsStateDictionary.Add( groupNamesTreeKey, isExpanded ); }