internal bool Contains(object item)
        {
            var group = item as DataGridCollectionViewGroup;

            if (group != null)
            {
                //Must make sure the group the group is ref equals, because there can be groups with a null name at more than one level.
                DataGridCollectionViewGroup foundGroup;
                if (m_subGroups.TryGetValue(DataGridCollectionViewGroup.GetHashKeyFromName(group.Name), out foundGroup))
                {
                    return(foundGroup == group);
                }

                return(false);
            }

            DataGridCollectionView collectionView = this.GetCollectionView();

            if (collectionView != null)
            {
                RawItem rawItem = collectionView.GetFirstRawItemFromDataItem(item);
                if (rawItem != null)
                {
                    return(rawItem.ParentGroup == this);
                }
            }

            return(false);
        }
示例#2
0
        internal bool Contains(object dataItem)
        {
            DataGridCollectionView collectionView = this.GetCollectionView();

            if (collectionView != null)
            {
                RawItem rawItem = collectionView.GetFirstRawItemFromDataItem(dataItem);
                if (rawItem != null)
                {
                    return(rawItem.ParentGroup == this);
                }
            }

            return(false);
        }
示例#3
0
        internal int IndexOf(object dataItem)
        {
            DataGridCollectionView collectionView = this.GetCollectionView();

            if (collectionView != null)
            {
                RawItem rawItem = collectionView.GetFirstRawItemFromDataItem(dataItem);

                if ((rawItem != null) &&
                    (rawItem.ParentGroup == this))
                {
                    return(rawItem.SortedIndex);
                }
            }

            return(-1);
        }
        internal int IndexOf(object item)
        {
            if (item is DataGridCollectionViewGroup)
            {
                return(this.ProtectedItems.IndexOf(item));
            }

            DataGridCollectionView collectionView = this.GetCollectionView();

            if (collectionView != null)
            {
                RawItem rawItem = collectionView.GetFirstRawItemFromDataItem(item);

                if ((rawItem != null) && (rawItem.ParentGroup == this))
                {
                    return(rawItem.SortedIndex);
                }
            }

            return(-1);
        }