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.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.GridView.dll
Syntax
public class VirtualGridTableViewState : INotifyPropertyChanged
Constructors
VirtualGridTableViewState(Int32, Int32, Int32, Boolean)
Initializes a new instance of the VirtualGridTableViewState class.
Declaration
public VirtualGridTableViewState(int itemCount, int defaultItemSize, int itemSpacing, bool supportsPaging)
Parameters
|
System.Int32
itemCount
The item count. |
|
System.Int32
defaultItemSize
Default size of the item. |
|
System.Int32
itemSpacing
The item spacing. |
|
System.Boolean
supportsPaging
The supports paging. |
Properties
BottomPinnedItems
Gets a read only collection of all the items pinned at the bottom of the view.
Declaration
public ReadOnlyCollection<int> BottomPinnedItems { get; }
Property Value
|
System.Collections.ObjectModel.ReadOnlyCollection<System.Int32>
|
BottomPinnedItemsList
This property is only used for serialization purposes.
Declaration
public List<int> BottomPinnedItemsList { get; set; }
Property Value
|
System.Collections.Generic.List<System.Int32>
|
DefaultItemSize
Gets or sets the default size of items which have never been resized.
Declaration
public int DefaultItemSize { get; set; }
Property Value
|
System.Int32
|
DpiScale
Gets the current DPI scale factor.
Declaration
public SizeF DpiScale { get; }
Property Value
|
System.Drawing.SizeF
|
EnablePaging
Gets or sets a value indicating whether data is presented in chunks (pages) to the user.
Declaration
public bool EnablePaging { get; set; }
Property Value
|
System.Boolean
|
ExpandedSizes
This property is only used for serialization purposes.
Declaration
public Dictionary<int, int> ExpandedSizes { get; set; }
Property Value
|
System.Collections.Generic.Dictionary<System.Int32, System.Int32>
|
ItemCount
Gets or sets the total number of items to be displayed.
Declaration
public int ItemCount { get; set; }
Property Value
|
System.Int32
|
ItemSizes
This property is only used for serialization purposes.
Declaration
public Dictionary<int, int> ItemSizes { get; set; }
Property Value
|
System.Collections.Generic.Dictionary<System.Int32, System.Int32>
|
ItemSpacing
Gets or sets the spacing between adjucent items.
Declaration
public int ItemSpacing { get; set; }
Property Value
|
System.Int32
|
PageIndex
Gets or sets the index of the page currently presented in the grid.
Declaration
public int PageIndex { get; set; }
Property Value
|
System.Int32
|
PageSize
Gets or sets the number of rows shown per page when paging is enabled.
Declaration
public int PageSize { get; set; }
Property Value
|
System.Int32
|
SupportsPaging
Gets a value indicating whether paging is supported by this instance.
Declaration
public bool SupportsPaging { get; }
Property Value
|
System.Boolean
|
TopPinnedItems
Gets a read only collection of all the items pinned at the top of the view.
Declaration
public ReadOnlyCollection<int> TopPinnedItems { get; }
Property Value
|
System.Collections.ObjectModel.ReadOnlyCollection<System.Int32>
|
TopPinnedItemsList
This property is only used for serialization purposes.
Declaration
public List<int> TopPinnedItemsList { get; set; }
Property Value
|
System.Collections.Generic.List<System.Int32>
|
TotalPages
Gets the total number of pages when paging is enabled.
Declaration
public int TotalPages { get; }
Property Value
|
System.Int32
|
Methods
BeginUpdate()
Suspends calling UpdateOnItemSizeChanged()
Declaration
public void BeginUpdate()
DpiScaleChanged(SizeF)
Fires when the DPI scaling is changed.
Declaration
public virtual void DpiScaleChanged(SizeF scale)
Parameters
|
System.Drawing.SizeF
scale
The scale. |
EndUpdate()
Resumes calling UpdateOnItemSizeChanged(), forces an update.
Declaration
public void EndUpdate()
GetItemOffset(Int32)
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
public int GetItemOffset(int itemIndex)
Parameters
|
System.Int32
itemIndex
The index of the item. |
Returns
|
System.Int32
The total offset. |
GetItemScrollOffset(Int32)
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
public int GetItemScrollOffset(int itemIndex)
Parameters
|
System.Int32
itemIndex
The index of the item. |
Returns
|
System.Int32
The total offset. |
GetItemSize(Int32)
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
public int GetItemSize(int itemIndex)
Parameters
|
System.Int32
itemIndex
The index of the item. |
Returns
|
System.Int32
The size of the item. |
GetItemSize(Int32, Boolean)
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
public int GetItemSize(int itemIndex, bool checkPinned)
Parameters
|
System.Int32
itemIndex
The index of the item. |
|
System.Boolean
checkPinned
Determines if an item should be considered pinned if it is pinned. |
Returns
|
System.Int32
The size of the item. |
GetItemSize(Int32, Boolean, Boolean)
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
public int GetItemSize(int itemIndex, bool checkPinned, bool checkExpanded)
Parameters
|
System.Int32
itemIndex
The index of the item. |
|
System.Boolean
checkPinned
Determines if an item should be considered pinned if it is pinned. |
|
System.Boolean
checkExpanded
Determines if an expanded row should include its child view size. |
Returns
|
System.Int32
The size of the item. |
GetItemSizes()
Returns a read-only collection of the sizes of the item.
Declaration
public ReadOnlyCollection<KeyValuePair<int, int>> GetItemSizes()
Returns
|
System.Collections.ObjectModel.ReadOnlyCollection<System.Collections.Generic.KeyValuePair<System.Int32, System.Int32>>
Returns a read-only collection of the sizes of the item. |
GetPinPosition(Int32)
Gets the pin position of the specified item.
Declaration
public PinnedRowPosition GetPinPosition(int itemIndex)
Parameters
|
System.Int32
itemIndex
The index of the item. |
Returns
|
PinnedRowPosition
The pin position of the specified item. |
GetScrollDownTarget(Int32, Int32, out Int32)
Calculates and returns the scroller position and offset if scrolled down from the bottom of item [startIndex] with [scrollOffset].
Declaration
public int GetScrollDownTarget(int startIndex, int scrollOffset, out int targetIndex)
Parameters
|
System.Int32
startIndex
The current item from the scroller (the scroll operation starts from the bottom of this item). |
|
System.Int32
scrollOffset
The amount to scroll with. |
|
System.Int32
targetIndex
Returns the index of the item which should be set as Current to the scroller. |
Returns
|
System.Int32
Return the new scroll offset which should be set to the scroller after the Current has been set. |
GetScrollUpTarget(Int32, Int32, out Int32)
Calculates and returns the scroller position and offset if scrolled up from the bottom of item [startIndex] with [scrollOffset].
Declaration
public int GetScrollUpTarget(int startIndex, int scrollOffset, out int targetIndex)
Parameters
|
System.Int32
startIndex
The current item from the scroller (the scroll operation starts from the bottom of this item). |
|
System.Int32
scrollOffset
The amount to scroll with. |
|
System.Int32
targetIndex
Returns the index of the item which should be set as Current to the scroller. |
Returns
|
System.Int32
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
public int GetTotalItemSize()
Returns
|
System.Int32
The total item size. |
IsPinned(Int32)
Determines whether the item at the specified index is pinned.
Declaration
public bool IsPinned(int itemIndex)
Parameters
|
System.Int32
itemIndex
The index of the item. |
Returns
|
System.Boolean
True if the item is pinned, otherwise false. |
OnPageIndexChanged()
Fires the PageIndexChanged event.
Declaration
protected virtual void OnPageIndexChanged()
OnPageIndexChanging(Int32, Int32)
Fires the PageIndexChanging event.
Declaration
protected virtual bool OnPageIndexChanging(int oldValue, int newValue)
Parameters
|
System.Int32
oldValue
The old value. |
|
System.Int32
newValue
The new value. |
Returns
|
System.Boolean
|
OnPropertyChanged(String)
Declaration
protected virtual void OnPropertyChanged(string propertyName)
Parameters
|
System.String
propertyName
|
Reset()
Resets the collections with sized items.
Declaration
public void Reset()
ResetExpandedSize(Int32)
Resets the size of the item when it is expanded.
Declaration
public void ResetExpandedSize(int itemIndex)
Parameters
|
System.Int32
itemIndex
The index of the item. |
SetExpandedSize(Int32, Int32)
Sets the size of the item when it is expanded.
Declaration
public void SetExpandedSize(int itemIndex, int size)
Parameters
|
System.Int32
itemIndex
The index of the item. |
|
System.Int32
size
The size. |
SetItemSize(Int32, Int32)
Sets a custom size to the item with a given index.
Declaration
public void SetItemSize(int itemIndex, int size)
Parameters
|
System.Int32
itemIndex
The index of the item. |
|
System.Int32
size
The custom size to set. |
SetPinPosition(Int32, PinnedRowPosition)
Sets the pin position of the specified item.
Declaration
public void SetPinPosition(int itemIndex, PinnedRowPosition position)
Parameters
|
System.Int32
itemIndex
The index of the item. |
|
PinnedRowPosition
position
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
public void UpdateOnItemSizeChanged()
Events
PageIndexChanged
Occurs after the page index changes.
Declaration
public event EventHandler PageIndexChanged
Event Type
|
System.EventHandler
|
PageIndexChanging
Occurs before the page index changes.
Declaration
public event VirtualGridPageChangingEventHandler PageIndexChanging
Event Type
|
VirtualGridPageChangingEventHandler
|
PropertyChanged
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
|
System.ComponentModel.PropertyChangedEventHandler
|