Class GridRangeInfo
Defines a range of cells in the grid. Possible range types are: Row(s), Column(s), Cell(s), Table or Empty. GridRangeInfo is immutable.
Inheritance
Namespace: Syncfusion.UI.Xaml.CellGrid
Assembly: Syncfusion.SfCellGrid.UWP.dll
Syntax
public class GridRangeInfo : Object, IFormattable, ICloneable, IDisposable
Constructors
GridRangeInfo()
Initializes an empty GridRangeInfo object.
Declaration
public GridRangeInfo()
Remarks
This constructor initializes a new GridRangeInfo object with empty range type.
Fields
Empty
Represents a GridRangeInfo with its properties left uninitialized and range type set to GridRangeInfoType.Empty.
Declaration
public static readonly GridRangeInfo Empty
Field Value
Type |
---|
GridRangeInfo |
Remarks
A range is defined by its coordinates and range type. If uninitialized, the range type is GridRangeInfoType.Empty
Properties
Bottom
The row index of the bottom-right corner of the cell range.
Declaration
public int Bottom { get; }
Property Value
Type |
---|
System.Int32 |
Height
Gets the height of the range defined by this GridRangeInfo.
Declaration
public int Height { get; }
Property Value
Type |
---|
System.Int32 |
Info
Results of ToString method.
Declaration
public string Info { get; }
Property Value
Type |
---|
System.String |
IsCells
true if this represents a range of individual cells.
Declaration
public bool IsCells { get; }
Property Value
Type |
---|
System.Boolean |
IsCols
true if this represents a range of columns.
Declaration
public bool IsCols { get; }
Property Value
Type |
---|
System.Boolean |
IsEmpty
Tests whether this GridRangeInfo has a GridRangeInfoType of Empty.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if GridRangeInfoType is Empty; otherwise, false. |
IsRows
true if this represents a range of rows.
Declaration
public bool IsRows { get; }
Property Value
Type |
---|
System.Boolean |
IsTable
true if this represents a table.
Declaration
public bool IsTable { get; }
Property Value
Type |
---|
System.Boolean |
Left
The column index of the upper-left corner of the cell range.
Declaration
public int Left { get; }
Property Value
Type |
---|
System.Int32 |
RangeType
The GridRangeInfoType of this GridRangeInfo object.
Declaration
public GridRangeInfoType RangeType { get; }
Property Value
Type |
---|
GridRangeInfoType |
Right
The column index of the bottom-right corner of the cell range.
Declaration
public int Right { get; }
Property Value
Type |
---|
System.Int32 |
Top
The row index of the upper-left corner of the cell range.
Declaration
public int Top { get; }
Property Value
Type |
---|
System.Int32 |
Width
Gets the width of the range defined by this GridRangeInfo.
Declaration
public int Width { get; }
Property Value
Type |
---|
System.Int32 |
Methods
Auto(Int32, Int32)
Creates a new GridRangeInfo object for the specified row and column.
Declaration
public static GridRangeInfo Auto(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. -1 to create a range of columns or whole table. |
System.Int32 | colIndex | The column index. -1 to create a range of rows or whole table. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Remarks
If both row and column index are less than zero, a table will be created. If row index is less than zero and column index greater or equal to zero, a column range will be created. If row index is greater or equal to zero and column index less than zero, a row range will be created. Otherwise a cell range is created.
Auto(Int32, Int32, Int32, Int32)
Creates a new GridRangeInfo object for the specified rows and columns.
Declaration
public static GridRangeInfo Auto(int top, int left, int bottom, int right)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | top | The row index. -1 to create a range of columns or whole table. |
System.Int32 | left | The column index. -1 to create a range of rows or whole table. |
System.Int32 | bottom | Bottom row index. |
System.Int32 | right | Right column index. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Remarks
If both row and column index are less than zero, a table will be created. If row index is less than zero and column index greater or equal to zero, a column range will be created. If row index is greater or equal to zero and column index less than zero, a row range will be created. Otherwise a cell range is created.
Cell(Int32, Int32)
Creates a new GridRangeInfo object for the specified row and column index.
Declaration
public static GridRangeInfo Cell(int row, int col)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | row | The row index. |
System.Int32 | col | The column index. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Cells(Int32, Int32, Int32, Int32)
Creates a new GridRangeInfo object with the specified bounds.
Declaration
public static GridRangeInfo Cells(int top, int left, int bottom, int right)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | top | The row index of the upper-left corner of the cell range. |
System.Int32 | left | The column index of the upper-left corner of the cell range. |
System.Int32 | bottom | The row index of the bottom-right corner of the cell range. |
System.Int32 | right | The column index of the bottom-right corner of the cell range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Clone()
Creates an exact copy of this GridRangeInfo object.
Declaration
public virtual object Clone()
Returns
Type | Description |
---|---|
System.Object | The GridRangeInfo object that this method creates. |
Col(Int32)
Creates a new GridRangeInfo object for the specified column.
Declaration
public static GridRangeInfo Col(int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | colIndex | The column index of the cell range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Cols(Int32, Int32)
Creates a new GridRangeInfo object for the specified columns.
Declaration
public static GridRangeInfo Cols(int left, int right)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | left | The left column index of the cell range. |
System.Int32 | right | The right column index of the cell range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Compare(GridRangeInfo, GridRangeInfo)
Compares two range objects and returns if they are both equal.
Declaration
public static bool Compare(GridRangeInfo r1, GridRangeInfo r2)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | r1 | The left-hand side of the operator. |
GridRangeInfo | r2 | The right-hand side of the operator. |
Returns
Type | Description |
---|---|
System.Boolean | bool |
Contains(GridRangeInfo)
Determines if this range fully contains all of range
.
Declaration
public bool Contains(GridRangeInfo range)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The range to test. |
Returns
Type | Description |
---|---|
System.Boolean | true if range is a subset of this range. |
CopyAllMembers(GridRangeInfo)
Declaration
protected void CopyAllMembers(GridRangeInfo rg)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | rg |
Dispose()
Call the Dispose and SuppressFinalize method for dipose the instance of GridRangeInfo class.
Declaration
public void Dispose()
Dispose(Boolean)
Dispose the live resources used by the GridRangeInfo class.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Dispose the instance, if it is True |
EmptyRange()
Returns Empty that is an empty range.
Declaration
public static GridRangeInfo EmptyRange()
Returns
Type | Description |
---|---|
GridRangeInfo | An empty range object. |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type |
---|
System.Boolean |
ExpandRange(Int32, Int32, Int32, Int32)
Convert column and row ranges into cell ranges with the specified bounds. (Could also be done through IntersectRange ... if nFirstRow >= nFirstCol >= 0).
Declaration
public GridRangeInfo ExpandRange(int nFirstRow, int nFirstCol, int nRowCount, int nColCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nFirstRow | Row index for the first non-label cell in grid area. |
System.Int32 | nFirstCol | Column index for the first non-label cell in grid area. |
System.Int32 | nRowCount | Last row in the grid. |
System.Int32 | nColCount | Last column in the grid |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Remarks
Column ranges will be converted to cell ranges using nFirstRow and nRowCount. Row ranges will be converted to cell ranges using nFirstCol and nColCount. Column ranges will be converted to cell ranges using all input parameters.
FromTlhw(Int32, Int32, Int32, Int32)
Creates a new GridRangeInfo object with the specified bounds.
Declaration
public static GridRangeInfo FromTlhw(int top, int left, int height, int width)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | top | The row index of the upper-left corner of the cell range. |
System.Int32 | left | The column index of the upper-left corner of the cell range. |
System.Int32 | height | Number of rows to span. |
System.Int32 | width | Number of columns to span. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
GetAlphaLabel(Int32)
Returns a string in the format "A, B, C, ... AA, AB ..." to be used for column labels.
Declaration
public static string GetAlphaLabel(int nCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nCol | The column index. |
Returns
Type | Description |
---|---|
System.String | A string that contains the column label for the column index. |
GetFirstCell(out Int32, out Int32)
Enumerate through all cells in range object.
Declaration
public bool GetFirstCell(out int top, out int left)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | top | The row index of the upper-left corner of the cell range. |
System.Int32 | left | The column index of the upper-left corner of the cell range. |
Returns
Type | Description |
---|---|
System.Boolean | This method returns the first cell in the range. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
---|
System.Int32 |
GetNextCell(ref Int32, ref Int32)
This method returns the adjacent cell in the range for the given row and column index.
Declaration
public bool GetNextCell(ref int nRow, ref int nCol)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nRow | The row index. |
System.Int32 | nCol | The column index. |
Returns
Type | Description |
---|---|
System.Boolean | true if an adjacent cell in this GridRangeInfo object coud be found; otherwise, false. |
GetNextCell(ref Int32, ref Int32, Boolean)
This method returns the adjacent cell in the range for the given row and column index.
Declaration
public bool GetNextCell(ref int nRow, ref int nCol, bool bSortByRow)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nRow | The row index. |
System.Int32 | nCol | The column index. |
System.Boolean | bSortByRow | true if the range should be traversed by row; false if the range should be traversed by column. |
Returns
Type | Description |
---|---|
System.Boolean | true if an adjacent cell in this GridRangeInfo object could be found; otherwise, false. |
GetNumericLabel(Int32)
Returns a numeric string in the format to be used for row labels.
Declaration
public static string GetNumericLabel(int nRow)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | nRow | The row index. |
Returns
Type | Description |
---|---|
System.String | A string that contains the row label for the row index. |
IntersectRange(GridRangeInfo)
Creates a new GridRangeInfo with the intersection of itself and the specified GridRangeInfo.
Declaration
public GridRangeInfo IntersectRange(GridRangeInfo range)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The GridRangeInfo with which to intersect. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Examples
The following example creates two GridRangeInfo objects and creates a GridRangeInfo with their intersection:
GridRangeInfo firstRange = GridRangeInfo.Cells(1, 1, 100, 100);
IntersectRange(GridRangeInfo, GridRangeInfo)
Creates a new GridRangeInfo with the intersection of two GridRangeInfo parameters.
Declaration
public static GridRangeInfo IntersectRange(GridRangeInfo r1, GridRangeInfo r2)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | r1 | The first GridRangeInfo with which to intersect. |
GridRangeInfo | r2 | The second GridRangeInfo with which to intersect. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Examples
The following example creates two GridRangeInfo objects and creates a GridRangeInfo with their intersection:
GridRangeInfo firstRange = GridRangeInfo.Cells(1, 1, 100, 100);
IntersectsWith(GridRangeInfo)
Determines if this range intersects with range
.
Declaration
public bool IntersectsWith(GridRangeInfo range)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | The range to test. |
Returns
Type | Description |
---|---|
System.Boolean | true if there is any intersection. |
Examples
The following example creates two cell ranges and tests whether they intersect:
GridRangeInfo firstRange = GridRangeInfo.Cells(1, 1, 100, 100);
OffsetRange(Int32, Int32)
Adjusts the location of this range by the specified amount.
Declaration
public GridRangeInfo OffsetRange(int rowOffset, int colOffset)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowOffset | Amount of rows to offset the location. |
System.Int32 | colOffset | Amount of columns to offset the location. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Parse(String)
Creates a range object from a string.
Declaration
public static GridRangeInfo Parse(string parseText)
Parameters
Type | Name | Description |
---|---|---|
System.String | parseText | The text with text representation of the range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The GridRangeInfo with coordinates specifed in the string. |
Remarks
The method parses a string that was previously created with ToString().
The string should be in the format R#C#, R#, C#, T.
An example for a range of cells is "R1C1:R10C20" or "R5C5".
An example for a range of rows is "R1:R10" or "R6".
An example for a range of columns is "C1:C10" or "C7".
An example for a table range is "T".
Row(Int32)
Creates a new GridRangeInfo object for the specified row index.
Declaration
public static GridRangeInfo Row(int rowIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index of the cell range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Rows(Int32, Int32)
Creates a new GridRangeInfo object for the specified rows.
Declaration
public static GridRangeInfo Rows(int top, int bottom)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | top | The top row index of the cell range. |
System.Int32 | bottom | The botom row index of the cell range. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Table()
Creates a new GridRangeInfo object for the whole table.
Declaration
public static GridRangeInfo Table()
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
ToString()
Converts the attributes of this GridRangeInfo to a human-readable string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string that contains the column and row index of the top-left and bottom-right position of this GridRangeInfo. |
Remarks
The generate string will be in the format R#C#, R#, C#, T.
An example for a range of cells is "R1C1:R10C20" or "R5C5".
An example for a range of rows is "R1:R10" or "R6".
An example for a range of columns is "C1:C10" or "C7".
An example for a table range is "T".
ToString(IFormatProvider)
Converts the attributes of this GridRangeInfo to a human-readable string.
Declaration
public string ToString(IFormatProvider provider)
Parameters
Type | Name | Description |
---|---|---|
System.IFormatProvider | provider | The System.IFormatProvider to use to format the value. Is ignored. |
Returns
Type | Description |
---|---|
System.String | A string that contains the column and row index of the top-left and bottom-right position of this GridRangeInfo. |
ToString(String)
Converts the attributes of this GridRangeInfo to a human-readable string.
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | Ignored. |
Returns
Type | Description |
---|---|
System.String | A string that contains the column and row index of the top-left and bottom-right position of this GridRangeInfo. |
ToString(String, IFormatProvider)
Converts the attributes of this GridRangeInfo to a human-readable string.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | Ignored. |
System.IFormatProvider | formatProvider | The System.IFormatProvider to use to format the value. Is ignored. |
Returns
Type | Description |
---|---|
System.String | A string that contains the column and row index of the top-left and bottom-right position of this GridRangeInfo. |
UnionRange(GridRangeInfo)
Creates a GridRangeInfo that represents the union of itself and another range.
Declaration
public GridRangeInfo UnionRange(GridRangeInfo range)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | range | A range to union. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
UnionRange(GridRangeInfo, GridRangeInfo)
Creates a GridRangeInfo that represents the union of two ranges.
Declaration
public static GridRangeInfo UnionRange(GridRangeInfo r1, GridRangeInfo r2)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | r1 | A range to union. |
GridRangeInfo | r2 | A range to union. |
Returns
Type | Description |
---|---|
GridRangeInfo | The new GridRangeInfo that this method creates. |
Operators
Equality(GridRangeInfo, GridRangeInfo)
Declaration
public static bool operator ==(GridRangeInfo r1, GridRangeInfo r2)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | r1 | |
GridRangeInfo | r2 |
Returns
Type |
---|
System.Boolean |
Inequality(GridRangeInfo, GridRangeInfo)
Declaration
public static bool operator !=(GridRangeInfo r1, GridRangeInfo r2)
Parameters
Type | Name | Description |
---|---|---|
GridRangeInfo | r1 | |
GridRangeInfo | r2 |
Returns
Type |
---|
System.Boolean |