BrightIdeasSoftware.VirtualObjectListView.GetNextItem C# (CSharp) Метод

GetNextItem() публичный Метод

Return the ListViewItem that appears immediately after the given item. If the given item is null, the first item in the list will be returned. Return null if the given item is the last item.
public GetNextItem ( BrightIdeasSoftware.OLVListItem itemToFind ) : BrightIdeasSoftware.OLVListItem
itemToFind BrightIdeasSoftware.OLVListItem The item that is before the item that is returned, or null
Результат BrightIdeasSoftware.OLVListItem
        public override OLVListItem GetNextItem(OLVListItem itemToFind)
        {
            if (!this.ShowGroups)
                return base.GetNextItem(itemToFind);

            // Sanity
            if (this.OLVGroups == null || this.OLVGroups.Count == 0)
                return null;

            // If the given item is null, return the first member of the first group
            if (itemToFind == null) {
                return this.GetItem(this.GroupingStrategy.GetGroupMember(this.OLVGroups[0], 0));
            }

            // Find where this item occurs (which group and where in that group)
            int groupIndex = this.GroupingStrategy.GetGroup(itemToFind.Index);
            int indexWithinGroup = this.GroupingStrategy.GetIndexWithinGroup(this.OLVGroups[groupIndex], itemToFind.Index);

            // If it's not the last member, just return the next member
            if (indexWithinGroup < this.OLVGroups[groupIndex].VirtualItemCount - 1)
                return this.GetItem(this.GroupingStrategy.GetGroupMember(this.OLVGroups[groupIndex], indexWithinGroup + 1));

            // The item is the last member of its group. Return the first member of the next group
            // (unless there isn't a next group)
            if (groupIndex < this.OLVGroups.Count - 1)
                return this.GetItem(this.GroupingStrategy.GetGroupMember(this.OLVGroups[groupIndex + 1], 0));

            return null;
        }