Class RowColumnIndexValueDictionary<T>
A generic class that emulates a subset of a Dictionary{T}. Internally rows are held in a dictionary and each row has a dictionary of cells. The class also provides support for adding, removing and moving rows and columns.
Inheritance
Implements
Namespace: Syncfusion.Windows.Controls.Cells
Assembly: Syncfusion.GridCommon.WPF.dll
Syntax
public class RowColumnIndexValueDictionary<T> : Object, IEnumerable<KeyValuePair<RowColumnIndex, T>>, IEnumerable
Type Parameters
Name |
---|
T |
Constructors
RowColumnIndexValueDictionary()
Initializes a new instance of the RowColumnIndexValueDictionary<T> class.
Declaration
public RowColumnIndexValueDictionary()
RowColumnIndexValueDictionary(IRowColumnIndexValueDictionaryCallbacks<T>)
Initializes a new instance of the RowColumnIndexValueDictionary<T> class.
Declaration
public RowColumnIndexValueDictionary(IRowColumnIndexValueDictionaryCallbacks<T> callback)
Parameters
Type | Name | Description |
---|---|---|
IRowColumnIndexValueDictionaryCallbacks<T> | callback | The callback for moved and removed cell notifications. |
Properties
Count
Gets the count.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The count. |
Item[RowColumnIndex]
Gets or sets the value for the specified cell.
Declaration
public T this[RowColumnIndex cell] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cell |
Property Value
Type |
---|
T |
NotifyMovedRow
Let derived class specify whether a OnMovedCell needs to be called for each cell that belongs to a row whose index position was changed after a move, insert or remove operation. If set (default is true) calls to InsertRows and RemoveRows will notify each cell in rows above the modified range of row that its row index was changed. Set this false when you do not need this information for each cell element to avoid unnecessary looping through rows.
CellDrawingVisualsDictionary is a derived class which sets this false. This will speed up insert and remove operations for drawing visuals. Only visuals that were removed need to be looped through then.
This property does not affect the OnRemoveCell callback. For each row that is removed the class will still notify each cell that it was removed.
Declaration
public bool NotifyMovedRow { get; set; }
Property Value
Type |
---|
System.Boolean |
Rows
Gets the rows.
Declaration
public Dictionary<int, IntegerValueCellsDictionary<T>> Rows { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.Int32, IntegerValueCellsDictionary<T>> | The rows. |
Methods
Add(RowColumnIndex, T)
Adds the cell and its value the dictionary. There is no "OnMoveCell" callback triggered.
Declaration
public void Add(RowColumnIndex cell, T value)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cell | |
T | value |
Clear()
Clears out the dictionary. There are no "OnRemoveCell" notfications triggered.
Declaration
public void Clear()
Clear(RowColumnIndex)
Removes the cell from the dictionary. There is no "OnRemoveCell" callback triggered.
Declaration
public bool Clear(RowColumnIndex cell)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cell |
Returns
Type |
---|
System.Boolean |
ContainsKey(RowColumnIndex)
Determines whether a cell exists.
Declaration
public bool ContainsKey(RowColumnIndex cell)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cell | The cell. |
Returns
Type | Description |
---|---|
System.Boolean |
|
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<KeyValuePair<RowColumnIndex, T>> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<RowColumnIndex, T>> | A enumerator that can be used to iterate through the collection. |
InsertColumns(Int32, Int32, RowColumnIndexValueDictionary<T>)
Inserts the columns and calls OnMovedCell(RowColumnIndex, T) callback for each moved cell. When you specify moveCells then these cells will be added beginning at the first insert column.
Declaration
public void InsertColumns(int insertAtColumnIndex, int count, RowColumnIndexValueDictionary<T> moveCells)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | insertAtColumnIndex | Index of the insert at column. |
System.Int32 | count | The count. |
RowColumnIndexValueDictionary<T> | moveCells | The move cells. |
InsertRows(Int32, Int32, RowColumnIndexValueDictionary<T>)
Inserts the rows and calls OnMovedCell(RowColumnIndex, T) callback for each moved cell. When you specify moveCells then these cells will be added beginning at the first insert row.
Declaration
public void InsertRows(int insertAtRowIndex, int count, RowColumnIndexValueDictionary<T> moveCells)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | insertAtRowIndex | Index of the insert at row. |
System.Int32 | count | The count. |
RowColumnIndexValueDictionary<T> | moveCells | The move cells. |
Iterate(CellSpanInfoBase, RowColumnIndexValueDictionary<T>.RowColumnIndexValueDelegate)
Iterates through the specified cell span and calls the specified method for each existing cell in the range.
Declaration
public void Iterate(CellSpanInfoBase cellSpan, RowColumnIndexValueDictionary<T>.RowColumnIndexValueDelegate callback)
Parameters
Type | Name | Description |
---|---|---|
CellSpanInfoBase | cellSpan | The cell span. |
RowColumnIndexValueDictionary.RowColumnIndexValueDelegate<> | callback | The callback. |
OnMovedRow(KeyValuePair<Int32, IntegerValueCellsDictionary<T>>, Int32)
Called when a row was moved. The default implementation of this method loops through all cells in the row and calls OnMovedCell(RowColumnIndex, T) for each cell.
Declaration
protected virtual void OnMovedRow(KeyValuePair<int, IntegerValueCellsDictionary<T>> rowEntry, int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<System.Int32, IntegerValueCellsDictionary<T>> | rowEntry | The row entry. |
System.Int32 | rowIndex | Index of the row. |
OnRemovedRow(KeyValuePair<Int32, IntegerValueCellsDictionary<T>>)
Called when row was removed. The default implementation of this method loops through all cells in the row and calls OnRemoveCell(RowColumnIndex, T) for each cell.
Declaration
protected virtual void OnRemovedRow(KeyValuePair<int, IntegerValueCellsDictionary<T>> rowEntry)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<System.Int32, IntegerValueCellsDictionary<T>> | rowEntry | The row entry. |
Remove(CellSpanInfoBase)
Removes the specified cell span and calls OnRemoveCell(RowColumnIndex, T) callback for each deleted cell.
Declaration
public void Remove(CellSpanInfoBase cellSpan)
Parameters
Type | Name | Description |
---|---|---|
CellSpanInfoBase | cellSpan | The cell span. |
Remove(RowColumnIndex)
Removes the cell from the dictionary and calls OnRemoveCell(RowColumnIndex, T) callback for the deleted cell.
Declaration
public bool Remove(RowColumnIndex cell)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cell |
Returns
Type |
---|
System.Boolean |
RemoveAll()
Removes all entries from the dictionary and calls OnRemoveCell(RowColumnIndex, T) callback for each deleted cell.
Declaration
public virtual void RemoveAll()
RemoveColumns(Int32, Int32, RowColumnIndexValueDictionary<T>)
Removes the columns and calls OnRemoveCell(RowColumnIndex, T) callback for each removed cell. When you specify moveCells the callback will not be called, instead the cells will be added to the moveCells dictionary. A subsequent InsertColumns call can then insert the columns at a different location.
Declaration
public void RemoveColumns(int removeAtColumnIndex, int count, RowColumnIndexValueDictionary<T> moveCells)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | removeAtColumnIndex | Index of the remove at column. |
System.Int32 | count | The count. |
RowColumnIndexValueDictionary<T> | moveCells | The move cells. |
RemoveRows(Int32, Int32, RowColumnIndexValueDictionary<T>)
Removes the rows and calls OnRemoveCell(RowColumnIndex, T) callback for each removed cell. When you specify moveCells the callback will not be called, instead the cells will be added to the moveCells dictionary. A subsequent InsertRows call can then insert the rows at a different location.
Declaration
public void RemoveRows(int removeAtRowIndex, int count, RowColumnIndexValueDictionary<T> moveCells)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | removeAtRowIndex | Index of the remove at row. |
System.Int32 | count | The count. |
RowColumnIndexValueDictionary<T> | moveCells | The move cells. |
SetCallback(IRowColumnIndexValueDictionaryCallbacks<T>)
Sets the callback.
Declaration
public void SetCallback(IRowColumnIndexValueDictionaryCallbacks<T> callback)
Parameters
Type | Name | Description |
---|---|---|
IRowColumnIndexValueDictionaryCallbacks<T> | callback | The callback. |
TryGetValue(RowColumnIndex, out T)
Tries to get the value if the cell exists.
Declaration
public bool TryGetValue(RowColumnIndex cell, out T value)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cell | The cell. |
T | value | The value. |
Returns
Type | Description |
---|---|
System.Boolean | true if cell exits; false otherwise. |