New to Telerik UI for WinFormsStart a free 30-day trial

Stores information about row sizes and provides methods for fast scrolling among millions of rows. The class only stores the sizes of rows which have been resized and uses additional structures to allow fast calculation of target state when scrolling with large amounts.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.GridView.dll

Syntax:

C#
public class VirtualGridTableViewState : INotifyPropertyChanged

Inheritance: objectVirtualGridTableViewState

Implements: INotifyPropertyChanged

Constructors

Initializes a new instance of the VirtualGridTableViewState class.

C#
public VirtualGridTableViewState(int itemCount, int defaultItemSize, int itemSpacing, bool supportsPaging)
Parameters:itemCountint

The item count.

defaultItemSizeint

Default size of the item.

itemSpacingint

The item spacing.

supportsPagingbool

The supports paging.

Properties

Gets a read only collection of all the items pinned at the bottom of the view.

C#
public ReadOnlyCollection<int> BottomPinnedItems { get; }

Gets or sets the default size of items which have never been resized.

C#
public int DefaultItemSize { get; set; }

Gets the current DPI scale factor.

C#
public SizeF DpiScale { get; }

Gets or sets a value indicating whether data is presented in chunks (pages) to the user.

C#
public bool EnablePaging { get; set; }

Gets or sets the total number of items to be displayed.

C#
public int ItemCount { get; set; }

Gets or sets the spacing between adjucent items.

C#
public int ItemSpacing { get; set; }

Gets or sets the index of the page currently presented in the grid.

C#
public int PageIndex { get; set; }

Gets or sets the number of rows shown per page when paging is enabled.

C#
public int PageSize { get; set; }

Gets a value indicating whether paging is supported by this instance.

C#
public bool SupportsPaging { get; }

Gets a read only collection of all the items pinned at the top of the view.

C#
public ReadOnlyCollection<int> TopPinnedItems { get; }

Gets the total number of pages when paging is enabled.

C#
public int TotalPages { get; }

Methods

Suspends calling UpdateOnItemSizeChanged()

C#
public void BeginUpdate()

Fires when the DPI scaling is changed.

C#
public virtual void DpiScaleChanged(SizeF scale)
Parameters:scaleSizeF

The scale.

Resumes calling UpdateOnItemSizeChanged(), forces an update.

C#
public void EndUpdate()

Gets the total offset from the beginning of the items to the top edge of the specified item. The method does not consider if paging is enabled.

C#
public int GetItemOffset(int itemIndex)
Parameters:itemIndexint

The index of the item.

Returns:

int

The total offset.

Gets the scroll offset from the beginning of the items in the current view to the top edge of the specified item. The method considers if paging is enabled.

C#
public int GetItemScrollOffset(int itemIndex)
Parameters:itemIndexint

The index of the item.

Returns:

int

The total offset.

Gets the currently set size of an item with a given index. Checks if the item is pinned or expanded. Return 0 for pinned items and the total expanded size for expanded items.

C#
public int GetItemSize(int itemIndex, bool checkPinned, bool checkExpanded)
Parameters:itemIndexint

The index of the item.

checkPinnedbool

Determines if an item should be considered pinned if it is pinned.

checkExpandedbool

Determines if an expanded row should include its child view size.

Returns:

int

The size of the item.

Gets the currently set size of an item with a given index. Checks if the item is pinned or expanded. Return 0 for pinned items and the total expanded size for expanded items.

C#
public int GetItemSize(int itemIndex, bool checkPinned)
Parameters:itemIndexint

The index of the item.

checkPinnedbool

Determines if an item should be considered pinned if it is pinned.

Returns:

int

The size of the item.

Gets the currently set size of an item with a given index. Checks if the item is pinned or expanded. Return 0 for pinned items and the total expanded size for expanded items.

C#
public int GetItemSize(int itemIndex)
Parameters:itemIndexint

The index of the item.

Returns:

int

The size of the item.

Returns a read-only collection of the sizes of the item.

C#
public ReadOnlyCollection<KeyValuePair<int, int>> GetItemSizes()
Returns:

ReadOnlyCollection<KeyValuePair<int, int>>

Returns a read-only collection of the sizes of the item.

Gets the pin position of the specified item.

C#
public PinnedRowPosition GetPinPosition(int itemIndex)
Parameters:itemIndexint

The index of the item.

Returns:

PinnedRowPosition

The pin position of the specified item.

Calculates and returns the scroller position and offset if scrolled down from the bottom of item [startIndex] with [scrollOffset].

C#
public int GetScrollDownTarget(int startIndex, int scrollOffset, out int targetIndex)
Parameters:startIndexint

The current item from the scroller (the scroll operation starts from the bottom of this item).

scrollOffsetint

The amount to scroll with.

targetIndexint

Returns the index of the item which should be set as Current to the scroller.

Returns:

int

Return the new scroll offset which should be set to the scroller after the Current has been set.

Calculates and returns the scroller position and offset if scrolled up from the bottom of item [startIndex] with [scrollOffset].

C#
public int GetScrollUpTarget(int startIndex, int scrollOffset, out int targetIndex)
Parameters:startIndexint

The current item from the scroller (the scroll operation starts from the bottom of this item).

scrollOffsetint

The amount to scroll with.

targetIndexint

Returns the index of the item which should be set as Current to the scroller.

Returns:

int

Return the new scroll offset which should be set to the scroller after the Current has been set.

Calculates the total size of all items, using the ItemCount, DefaultItemSize, ItemSpacing, and considering the resized items. Used to calculate the maximum for the scrollbar.

C#
public int GetTotalItemSize()
Returns:

int

The total item size.

Determines whether the item at the specified index is pinned.

C#
public bool IsPinned(int itemIndex)
Parameters:itemIndexint

The index of the item.

Returns:

bool

True if the item is pinned, otherwise false.

Fires the event.

C#
protected virtual void OnPageIndexChanged()

Fires the event.

C#
protected virtual bool OnPageIndexChanging(int oldValue, int newValue)
Parameters:oldValueint

The old value.

newValueint

The new value.

Returns:

bool

C#
protected virtual void OnPropertyChanged(string propertyName)
Parameters:propertyNamestring

Resets the collections with sized items.

C#
public void Reset()

Resets the size of the item when it is expanded.

C#
public void ResetExpandedSize(int itemIndex)
Parameters:itemIndexint

The index of the item.

Sets the size of the item when it is expanded.

C#
public void SetExpandedSize(int itemIndex, int size)
Parameters:itemIndexint

The index of the item.

sizeint

The size.

Sets a custom size to the item with a given index.

C#
public void SetItemSize(int itemIndex, int size)
Parameters:itemIndexint

The index of the item.

sizeint

The custom size to set.

Sets the pin position of the specified item.

C#
public void SetPinPosition(int itemIndex, PinnedRowPosition position)
Parameters:itemIndexint

The index of the item.

positionPinnedRowPosition

The pin position.

Updates the internal structures when the size of an item changes. Needed for proper calculations of scroll offsets. See the description of [partialItemSizes] and [itemSizes] for more info.

C#
public void UpdateOnItemSizeChanged()

Events

Occurs after the page index changes.

C#
public event EventHandler PageIndexChanged

Occurs before the page index changes.

C#
public event VirtualGridPageChangingEventHandler PageIndexChanging
C#
public event PropertyChangedEventHandler PropertyChanged

Implements: INotifyPropertyChanged.PropertyChanged