alexa
Syncfusion
menu Syncfusion

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class DataGridColumnSizer

    Represents a class that handles the sizing for all the GridColumns in the Columns collection in a SfDataGrid control.

    Inheritance
    object
    DataGridColumnSizer
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Syncfusion.Maui.DataGrid
    Assembly: Syncfusion.Maui.DataGrid.dll
    Syntax
    public class DataGridColumnSizer : IDisposable

    Constructors

    DataGridColumnSizer()

    Initializes a new instance of the GridColumnSizer class.

    Declaration
    public DataGridColumnSizer()

    DataGridColumnSizer(SfDataGrid)

    Initializes a new instance of the GridColumnSizer class using the specified SfDataGrid instance,.

    Declaration
    public DataGridColumnSizer(SfDataGrid datagrid)
    Parameters
    Type Name Description
    SfDataGrid datagrid

    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

    Dispose()

    Perform final clean up before it is released from memory.

    Declaration
    public void Dispose()

    GetActualWidth(DataGridColumn, double)

    Gets the final computed width after checking the MaximumWidth,MinimumWidth constraints and sets it to the given column.

    Declaration
    public double GetActualWidth(DataGridColumn column, double calculatedWidth)
    Parameters
    Type Name Description
    DataGridColumn column

    A GridColumn in Columns collection.

    double calculatedWidth

    The previously calculated width value before checking the MaximumWidth and GridColumn.MinimumWidth constraints.

    Returns
    Type Description
    double

    Returns the actual width that is set to the GridColumn.

    GetColumnAutoSizeWidth(DataGridColumn)

    Gets the width that required to auto-fit the given column based on its both header and cell content.

    Declaration
    protected virtual double GetColumnAutoSizeWidth(DataGridColumn column)
    Parameters
    Type Name Description
    DataGridColumn column

    The column for which width has to be calculated.

    Returns
    Type Description
    double

    Returns the width required to auto-fit the given column based on its both header and cell content.

    GetColumnToFill()

    Gets the column which will fill to the remaining view port size in the SfDataGrid.

    Declaration
    protected virtual DataGridColumn? GetColumnToFill()
    Returns
    Type Description
    DataGridColumn

    the column to fill.

    OnColumnPropertyChanged(DataGridColumn, string)

    Represents the method that will handle the property changes of DataGridColumn.

    Declaration
    [UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "The EndEdit method is not trim compatible")]
    protected virtual void OnColumnPropertyChanged(DataGridColumn column, string propertyName)
    Parameters
    Type Name Description
    DataGridColumn column

    A GridColumn object.

    string propertyName

    The property name.

    OnComputeCellHeight(DataGridColumn, object?)

    Calculates the height of the data row's cells. You can override this method to perform the custom calculation for height.

    Declaration
    protected virtual double OnComputeCellHeight(DataGridColumn column, object? cellValue)
    Parameters
    Type Name Description
    DataGridColumn column

    The Current Column

    object cellValue

    The value of the current grid cell.

    Returns
    Type
    double

    OnComputeCellWidth(DataGridColumn, string)

    Measures and returns the text width based on the cell value.

    Declaration
    protected virtual double OnComputeCellWidth(DataGridColumn column, string text)
    Parameters
    Type Name Description
    DataGridColumn column

    current column.

    string text

    current column text.

    Returns
    Type Description
    double

    Returns the text width based on the cell value.

    OnComputeHeaderCellHeight(string, DataGridColumn)

    Calculates the height of the header cells. You can override this method to perform the custom calculation for height.

    Declaration
    protected virtual double OnComputeHeaderCellHeight(string cellValue, DataGridColumn column = null)
    Parameters
    Type Name Description
    string cellValue

    The value of the HeaderCell

    DataGridColumn column

    The current column.

    Returns
    Type
    double

    OnComputeHeaderCellWidth(string?, DataGridColumn)

    Calculates the width of the header cells. You can override this method to perform the custom calculation for width.

    Declaration
    protected virtual double OnComputeHeaderCellWidth(string? cellValue, DataGridColumn column = null)
    Parameters
    Type Name Description
    string cellValue

    Value of the header cell.

    DataGridColumn column

    The current column.

    Returns
    Type Description
    double

    Returns the width required to auto-fit the given column based on its header content.

    Refresh(bool)

    Refreshes the GridColumns in the view.

    Declaration
    public void Refresh(bool needsLayout = true)
    Parameters
    Type Name Description
    bool needsLayout

    A boolean value specifying whether layout is needed.

    ResetAutoWidth(DataGridColumn)

    Resets the auto width for the specified column.

    Declaration
    public void ResetAutoWidth(DataGridColumn column)
    Parameters
    Type Name Description
    DataGridColumn 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
    InvalidOperationException

    Thrown when the column is null.

    SetAutoWidth(DataGridColumn, double)

    Sets the measured cell width to the given column.

    Declaration
    public void SetAutoWidth(DataGridColumn column, double width)
    Parameters
    Type Name Description
    DataGridColumn column

    The corresponding column to set Auto width.

    double width

    The corresponding width set as Auto width.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when the column is null.

    SetFillWidthForColumns(double, IEnumerable<DataGridColumn>)

    Sets width for the given columns to fill the remaining view port width.

    Declaration
    protected virtual void SetFillWidthForColumns(double columnsWidth, IEnumerable<DataGridColumn> columns)
    Parameters
    Type Name Description
    double columnsWidth

    The width of the columns.

    IEnumerable<DataGridColumn> columns

    The collection of remaining GridColumn.

    Implements

    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved