Class DistanceRangeCounterCollection
A collection of entities for which distances need to be counted. The collection provides methods for mapping from a distance position to an entity and vice versa.
For example, in a scrollable grid control you have rows with different heights. Use this collection to determine the total height for all rows in the grid, quickly detemine the row index for a given point and also quickly determine the point at which a row is displayed. This also allows a mapping between the scrollbars value and the rows or columns associated with that value.
Inheritance
Namespace: Syncfusion.UI.Xaml.ScrollAxis
Assembly: Syncfusion.SfGrid.WPF.dll
Syntax
public class DistanceRangeCounterCollection : Object, IDistanceCounterCollection, IDisposable
Remarks
DistanceCounterCollection internally uses ranges for allocating objects up to the modified entry with the highest index. When you modify the size of an entry the collection ensures that that objects are allocated for all entries up to the given index. Entries that are after the modified entry are assumed to have the DefaultSize and will not be allocated.
Ranges will only be allocated for those lines that have different sizes. If you do for example only change the size of line 100 to be 10 then the collection will internally create two ranges: Range 1 from 0-99 with DefaultSize and Range 2 from 100-100 with size 10. This approach makes this collection work very efficient with grid scenarios where often many rows have the same height.
Constructors
DistanceRangeCounterCollection()
Declaration
public DistanceRangeCounterCollection()
DistanceRangeCounterCollection(Double)
Constructs the class and initializes the internal tree.
Declaration
public DistanceRangeCounterCollection(double paddingDistance)
Parameters
Type | Name | Description |
---|---|---|
System.Double | paddingDistance |
Fields
paddingDistance
Declaration
public double paddingDistance
Field Value
Type |
---|
System.Double |
Properties
Count
The raw number of entities (lines, rows or columns).
Declaration
public int Count { get; set; }
Property Value
Type |
---|
System.Int32 |
DefaultDistance
The default distance (row height or column width) an entity spans
Declaration
public double DefaultDistance { get; set; }
Property Value
Type |
---|
System.Double |
Empty
Returns an empty collection.
Declaration
public static DistanceRangeCounterCollection Empty { get; }
Property Value
Type |
---|
DistanceRangeCounterCollection |
Item[Int32]
Gets or sets the distance for an entity.
Declaration
public double this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index for the entity |
Property Value
Type |
---|
System.Double |
TotalDistance
The total distance all entities span (e.g. total height of all rows in grid)
Declaration
public double TotalDistance { get; }
Property Value
Type |
---|
System.Double |
Methods
Clear()
Clears this instance.
Declaration
public void Clear()
ConnectWithParent(ITreeTableCounterSource)
Connects a nested distance collection with a parent.
Declaration
public void ConnectWithParent(ITreeTableCounterSource treeTableCounterSource)
Parameters
Type | Name | Description |
---|---|---|
ITreeTableCounterSource | treeTableCounterSource | The nested tree table visible counter source. |
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing |
GetAlignedScrollValue(Double)
Gets the aligned scroll value which is the starting point of the entity found at the given distance position.
Declaration
public double GetAlignedScrollValue(double point)
Parameters
Type | Name | Description |
---|---|---|
System.Double | point | The point. |
Returns
Type | Description |
---|---|
System.Double | The starting point of the entity. |
GetCumulatedDistanceAt(Int32)
Gets the cumulated count of previous distances for the entity at the specifiec index. (e.g. return pixel position for a row index).
Declaration
public double GetCumulatedDistanceAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The entity index. |
Returns
Type | Description |
---|---|
System.Double | The cumulated count of previous distances for the entity at the specifiec index. |
GetNestedDistances(Int32)
Gets the nested entities at a given index. If the index does not hold a mested distances collection the method returns null.
Declaration
public IDistanceCounterCollection GetNestedDistances(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
IDistanceCounterCollection | The nested collection or null. |
GetNextScrollValue(Double)
Gets the distance position of the next entity after a given point.
Declaration
public double GetNextScrollValue(double point)
Parameters
Type | Name | Description |
---|---|---|
System.Double | point | The point. |
Returns
Type | Description |
---|---|
System.Double | The distance position. |
GetNextVisibleIndex(Int32)
Skip subsequent entities for which the distance is 0.0 and return the next entity.
Declaration
public int GetNextVisibleIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Returns
Type |
---|
System.Int32 |
GetPreviousScrollValue(Double)
Gets the distance position of the entity preceeding a given point. If the point is in between entities the starting point of the matching entity is returned.
Declaration
public double GetPreviousScrollValue(double point)
Parameters
Type | Name | Description |
---|---|---|
System.Double | point | The point. |
Returns
Type | Description |
---|---|
System.Double | The distance position. |
GetPreviousVisibleIndex(Int32)
Skip previous entities for which the distance is 0.0 and return the next entity.
Declaration
public int GetPreviousVisibleIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Returns
Type |
---|
System.Int32 |
IndexOfCumulatedDistance(Double)
Gets the index of an entity in this collection for which the cumulated count of previous distances is greater or equal the specified cumulatedDistance. (e.g. return row index for pixel position).
Declaration
public int IndexOfCumulatedDistance(double cumulatedDistance)
Parameters
Type | Name | Description |
---|---|---|
System.Double | cumulatedDistance | The cumulated count of previous distances. |
Returns
Type | Description |
---|---|
System.Int32 | The entity index. |
Insert(Int32, Int32)
Insert entities in the collection.
Declaration
public void Insert(int insertAt, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | insertAt | Insert position. |
System.Int32 | count | The number of entities to be inserted. |
Insert(Int32, Int32, Double)
Insert entities in the collection.
Declaration
public void Insert(int insertAt, int count, double distance)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | insertAt | Insert position. |
System.Int32 | count | The number of entities to be inserted. |
System.Double | distance | The distance to be set. |
InvalidateNestedEntry(Int32)
Declaration
public void InvalidateNestedEntry(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Remove(Int32, Int32)
Removes enities from the collection.
Declaration
public void Remove(int removeAt, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | removeAt | Index of the first entity to be removed. |
System.Int32 | count | The number of entities to be removed. |
ResetRange(Int32, Int32)
Resets the range by restoring the default distance for all entries in the specified range.
Declaration
public void ResetRange(int from, int to)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | From. |
System.Int32 | to | To. |
SetNestedDistances(Int32, IDistanceCounterCollection)
Assigns a collection with nested entities to an item.
Declaration
public void SetNestedDistances(int index, IDistanceCounterCollection nestedCollection)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
IDistanceCounterCollection | nestedCollection | The nested collection. |
SetRange(Int32, Int32, Double)
Hides a specified range of entities (lines, rows or colums)
Declaration
public void SetRange(int from, int to, double distance)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | from | The index for the first entity> |
System.Int32 | to | The raw index for the last entity |
System.Double | distance | The distance. |