Class GridColumnSizer
Represents a class that handles the sizing for all the GridColumns in the Columns collection in a SfDataGrid control.
Inheritance
Implements
Namespace: Syncfusion.SfDataGrid
Assembly: Syncfusion.SfDataGrid.Android.dll
Syntax
public class GridColumnSizer : Object, IDisposable
Constructors
GridColumnSizer()
Initializes a new instance of the GridColumnSizer class.
Declaration
public GridColumnSizer()
GridColumnSizer(SfDataGrid)
Initializes a new instance of the GridColumnSizer class using the specified SfDataGrid instance,.
Declaration
public GridColumnSizer(SfDataGrid grid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | grid | The reference of the SfDataGrid. |
Properties
DataGrid
Gets the current instance of the SfDataGrid.
Declaration
public SfDataGrid DataGrid { get; }
Property Value
Type | Description |
---|---|
SfDataGrid | The current instance of the SfDataGrid. |
Methods
CalculateCellSize(Size, GridColumn, Object, GridQueryBounds, Double)
Gets the size of the cell to measure the width of the specified column.
Declaration
protected virtual Size CalculateCellSize(Size currentCellSize, GridColumn column, object data, GridQueryBounds bounds, double measuredWidth)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Size | currentCellSize | size of the cell. |
GridColumn | column | The corresponding column to measure its cell size. |
System.Object | data | The corresponding data to measure text size in cell. |
GridQueryBounds | bounds | Indicates a value whether to measure width or height. |
System.Double | measuredWidth | Measured width. |
Returns
Type | Description |
---|---|
System.Drawing.Size | Returns the size of the cell. |
Dispose()
Perform final clean up before it is released from memory.
Declaration
public void Dispose()
Dispose(Boolean)
Releases the unmanaged resources used by the component and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | if true - release both managed and unmanaged resources; if false - release only unmanaged resources. |
GetColumnAutoSizeWidth(GridColumn)
Gets the width required to auto-fit the given column based on its content.
Declaration
protected virtual double GetColumnAutoSizeWidth(GridColumn column)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column | The column for which width has to be calculated. |
Returns
Type | Description |
---|---|
System.Double | Returns the width required to auto-fit the given column based on its content. |
GetColumnToFill()
Gets the column to fill the remaining view port size based on ColumnSizer.
Declaration
protected virtual GridColumn GetColumnToFill()
Returns
Type | Description |
---|---|
GridColumn | the column to fill. |
GetHeaderCellWidth(GridColumn)
Gets the width required to auto-fit the given column based on its header content.
Declaration
protected virtual double GetHeaderCellWidth(GridColumn column)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column | The column for which width has to be calculated. |
Returns
Type | Description |
---|---|
System.Double | Returns the width required to auto-fit the given column based on its header content. |
OnColumnPropertyChanged(GridColumn, String)
Represents the method that will handle the property changes in grid columns.
Declaration
protected virtual void OnColumnPropertyChanged(GridColumn column, string propertyName)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column | A GridColumn object. |
System.String | propertyName | The property name. |
Refresh(Boolean)
Refreshes the GridColumns in the view.
Declaration
public void Refresh(bool needsLayout = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | needsLayout | A boolean value specifying whether layout is needed. |
ResetAutoWidth(GridColumn)
Resets the auto width for the specified column.
Declaration
public void ResetAutoWidth(GridColumn column)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column | The corresponding column to reset the auto width. |
Remarks
The column width is reset to double.Nan, if the column sizing needs to be recalculate based on the data.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the column is null. |
SetAutoWidth(GridColumn, Double)
Sets the width for the specified column based on ColumnSizer value as Auto.
Declaration
protected void SetAutoWidth(GridColumn column, double width)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column | The corresponding column to set Auto width. |
System.Double | width | The corresponding width set as Auto width. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | Thrown when the column is null. |
SetStarWidthForColumns(Double, IEnumerable<GridColumn>)
Sets star width for the remaining columns for which the widths are yet to be assigned.
Declaration
protected virtual void SetStarWidthForColumns(double columnsWidth, IEnumerable<GridColumn> columns)
Parameters
Type | Name | Description |
---|---|---|
System.Double | columnsWidth | The width of the columns. |
System.Collections.Generic.IEnumerable<GridColumn> | columns | The collection of remaining GridColumn. |