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.XForms
Assembly: Syncfusion.SfDataGrid.XForms.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 |
---|---|---|
Xamarin.Forms.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 |
---|---|
Xamarin.Forms.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. |
GetActualWidth(GridColumn, Double)
Gets the final computed actual width after checking the MaximumWidth,MinimumWidth constraints and sets it to the specified GridColumn.
Declaration
public double GetActualWidth(GridColumn column, double calculatedWidth)
Parameters
Type | Name | Description |
---|---|---|
GridColumn | column | A GridColumn in Columns collection. |
System.Double | calculatedWidth | The previously calculated width value before checking the MaximumWidth and MinimumWidth constraints. |
Returns
Type | Description |
---|---|
System.Double | Returns the actual width that is set to the GridColumn. |
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. |