Class
VirtualGridTableViewState

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:

cs-api-definition
public class VirtualGridTableViewState : INotifyPropertyChanged

Inheritance: objectVirtualGridTableViewState

Implements: INotifyPropertyChanged

Constructors

VirtualGridTableViewState(int, int, int, bool)

Initializes a new instance of the VirtualGridTableViewState class.

Declaration

cs-api-definition
public VirtualGridTableViewState(int itemCount, int defaultItemSize, int itemSpacing, bool supportsPaging)

Parameters

itemCount

int

The item count.

defaultItemSize

int

Default size of the item.

itemSpacing

int

The item spacing.

supportsPaging

bool

The supports paging.

Properties

BottomPinnedItems

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

Declaration

cs-api-definition
public ReadOnlyCollection<int> BottomPinnedItems { get; }

Property Value

ReadOnlyCollection<int>

DefaultItemSize

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

Declaration

cs-api-definition
public int DefaultItemSize { get; set; }

Property Value

int

DpiScale

Gets the current DPI scale factor.

Declaration

cs-api-definition
public SizeF DpiScale { get; }

Property Value

SizeF

EnablePaging

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

Declaration

cs-api-definition
public bool EnablePaging { get; set; }

Property Value

bool

ItemCount

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

Declaration

cs-api-definition
public int ItemCount { get; set; }

Property Value

int

ItemSpacing

Gets or sets the spacing between adjucent items.

Declaration

cs-api-definition
public int ItemSpacing { get; set; }

Property Value

int

PageIndex

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

Declaration

cs-api-definition
public int PageIndex { get; set; }

Property Value

int

PageSize

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

Declaration

cs-api-definition
public int PageSize { get; set; }

Property Value

int

SupportsPaging

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

Declaration

cs-api-definition
public bool SupportsPaging { get; }

Property Value

bool

TopPinnedItems

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

Declaration

cs-api-definition
public ReadOnlyCollection<int> TopPinnedItems { get; }

Property Value

ReadOnlyCollection<int>

TotalPages

Gets the total number of pages when paging is enabled.

Declaration

cs-api-definition
public int TotalPages { get; }

Property Value

int

Methods

BeginUpdate()

Suspends calling UpdateOnItemSizeChanged()

Declaration

cs-api-definition
public void BeginUpdate()

DpiScaleChanged(SizeF)

Fires when the DPI scaling is changed.

Declaration

cs-api-definition
public virtual void DpiScaleChanged(SizeF scale)

Parameters

scale

SizeF

The scale.

EndUpdate()

Resumes calling UpdateOnItemSizeChanged(), forces an update.

Declaration

cs-api-definition
public void EndUpdate()

GetItemOffset(int)

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.

Declaration

cs-api-definition
public int GetItemOffset(int itemIndex)

Parameters

itemIndex

int

The index of the item.

Returns

int

The total offset.

GetItemScrollOffset(int)

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.

Declaration

cs-api-definition
public int GetItemScrollOffset(int itemIndex)

Parameters

itemIndex

int

The index of the item.

Returns

int

The total offset.

GetItemSize(int)

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.

Declaration

cs-api-definition
public int GetItemSize(int itemIndex)

Parameters

itemIndex

int

The index of the item.

Returns

int

The size of the item.

GetItemSize(int, bool)

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.

Declaration

cs-api-definition
public int GetItemSize(int itemIndex, bool checkPinned)

Parameters

itemIndex

int

The index of the item.

checkPinned

bool

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

Returns

int

The size of the item.

GetItemSize(int, bool, bool)

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.

Declaration

cs-api-definition
public int GetItemSize(int itemIndex, bool checkPinned, bool checkExpanded)

Parameters

itemIndex

int

The index of the item.

checkPinned

bool

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

checkExpanded

bool

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

Returns

int

The size of the item.

GetItemSizes()

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

Declaration

cs-api-definition
public ReadOnlyCollection<KeyValuePair<int, int>> GetItemSizes()

Returns

ReadOnlyCollection<KeyValuePair<int, int>>

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

GetPinPosition(int)

Gets the pin position of the specified item.

Declaration

cs-api-definition
public PinnedRowPosition GetPinPosition(int itemIndex)

Parameters

itemIndex

int

The index of the item.

Returns

PinnedRowPosition

The pin position of the specified item.

GetScrollDownTarget(int, int, out int)

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

Declaration

cs-api-definition
public int GetScrollDownTarget(int startIndex, int scrollOffset, out int targetIndex)

Parameters

startIndex

int

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

scrollOffset

int

The amount to scroll with.

targetIndex

int

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.

GetScrollUpTarget(int, int, out int)

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

Declaration

cs-api-definition
public int GetScrollUpTarget(int startIndex, int scrollOffset, out int targetIndex)

Parameters

startIndex

int

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

scrollOffset

int

The amount to scroll with.

targetIndex

int

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.

GetTotalItemSize()

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.

Declaration

cs-api-definition
public int GetTotalItemSize()

Returns

int

The total item size.

IsPinned(int)

Determines whether the item at the specified index is pinned.

Declaration

cs-api-definition
public bool IsPinned(int itemIndex)

Parameters

itemIndex

int

The index of the item.

Returns

bool

True if the item is pinned, otherwise false.

OnPageIndexChanged()

Fires the event.

Declaration

cs-api-definition
protected virtual void OnPageIndexChanged()

OnPageIndexChanging(int, int)

Fires the event.

Declaration

cs-api-definition
protected virtual bool OnPageIndexChanging(int oldValue, int newValue)

Parameters

oldValue

int

The old value.

newValue

int

The new value.

Returns

bool

OnPropertyChanged(string)

Declaration

cs-api-definition
protected virtual void OnPropertyChanged(string propertyName)

Parameters

propertyName

string

Reset()

Resets the collections with sized items.

Declaration

cs-api-definition
public void Reset()

ResetExpandedSize(int)

Resets the size of the item when it is expanded.

Declaration

cs-api-definition
public void ResetExpandedSize(int itemIndex)

Parameters

itemIndex

int

The index of the item.

SetExpandedSize(int, int)

Sets the size of the item when it is expanded.

Declaration

cs-api-definition
public void SetExpandedSize(int itemIndex, int size)

Parameters

itemIndex

int

The index of the item.

size

int

The size.

SetItemSize(int, int)

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

Declaration

cs-api-definition
public void SetItemSize(int itemIndex, int size)

Parameters

itemIndex

int

The index of the item.

size

int

The custom size to set.

SetPinPosition(int, PinnedRowPosition)

Sets the pin position of the specified item.

Declaration

cs-api-definition
public void SetPinPosition(int itemIndex, PinnedRowPosition position)

Parameters

itemIndex

int

The index of the item.

position

PinnedRowPosition

The pin position.

UpdateOnItemSizeChanged()

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.

Declaration

cs-api-definition
public void UpdateOnItemSizeChanged()

Events

PageIndexChanged

Occurs after the page index changes.

Declaration

cs-api-definition
public event EventHandler PageIndexChanged

Event Value

EventHandler

PageIndexChanging

Occurs before the page index changes.

Declaration

cs-api-definition
public event VirtualGridPageChangingEventHandler PageIndexChanging

Event Value

VirtualGridPageChangingEventHandler

PropertyChanged

Declaration

cs-api-definition
public event PropertyChangedEventHandler PropertyChanged

Event Value

PropertyChangedEventHandler

Implements INotifyPropertyChanged.PropertyChanged