menu

UWP

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TreeGridColumnSizer - UWP API Reference | Syncfusion

    Show / Hide Table of Contents

    Class TreeGridColumnSizer

    Represents a class that provides the implementation to calculate column widths based on different column sizer options for SfTreeGrid(TreeColumnSizer).

    Inheritance
    System.Object
    ColumnSizerBase<SfTreeGrid>
    TreeGridColumnSizer
    Implements
    System.IDisposable
    Inherited Members
    ColumnSizerBase<SfTreeGrid>.AutoFitMode
    ColumnSizerBase<SfTreeGrid>.Control
    ColumnSizerBase<SfTreeGrid>.Dispose()
    ColumnSizerBase<SfTreeGrid>.FontFamily
    ColumnSizerBase<SfTreeGrid>.FontFamilyProperty
    ColumnSizerBase<SfTreeGrid>.FontSize
    ColumnSizerBase<SfTreeGrid>.FontSizeProperty
    ColumnSizerBase<SfTreeGrid>.FontStretch
    ColumnSizerBase<SfTreeGrid>.FontStretchProperty
    ColumnSizerBase<SfTreeGrid>.FontWeight
    ColumnSizerBase<SfTreeGrid>.FontWeightProperty
    ColumnSizerBase<SfTreeGrid>.GetFontFamily(GridColumnBase)
    ColumnSizerBase<SfTreeGrid>.GetFontSize(GridColumnBase)
    ColumnSizerBase<SfTreeGrid>.GetFontStretch(GridColumnBase)
    ColumnSizerBase<SfTreeGrid>.GetFontWeight(GridColumnBase)
    ColumnSizerBase<SfTreeGrid>.GetMargin(GridColumnBase)
    ColumnSizerBase<SfTreeGrid>.Margin
    ColumnSizerBase<SfTreeGrid>.MarginProperty
    ColumnSizerBase<SfTreeGrid>.ResetAutoCalculation(GridColumnBase)
    ColumnSizerBase<SfTreeGrid>.ResetAutoCalculationforAllColumns()
    ColumnSizerBase<SfTreeGrid>.Resume()
    ColumnSizerBase<SfTreeGrid>.SetFontFamily(GridColumnBase, FontFamily)
    ColumnSizerBase<SfTreeGrid>.SetFontSize(GridColumnBase, Double)
    ColumnSizerBase<SfTreeGrid>.SetFontStretch(GridColumnBase, FontStretch)
    ColumnSizerBase<SfTreeGrid>.SetFontWeight(GridColumnBase, FontWeight)
    ColumnSizerBase<SfTreeGrid>.SetMargin(GridColumnBase, Thickness)
    ColumnSizerBase<SfTreeGrid>.SortIconWidth
    ColumnSizerBase<SfTreeGrid>.Suspend()
    ColumnSizerBase<SfTreeGrid>.TextBlock
    Namespace: Syncfusion.UI.Xaml.TreeGrid
    Assembly: Syncfusion.SfGrid.UWP.dll
    Syntax
    public class TreeGridColumnSizer : ColumnSizerBase<SfTreeGrid>, IDisposable

    Constructors

    TreeGridColumnSizer()

    Initializes a new instance of TreeGridColumnSizer class.

    Declaration
    public TreeGridColumnSizer()

    TreeGridColumnSizer(SfTreeGrid)

    Initializes a new instance of TreeGridColumnSizer class with specififed SfTreeGrid.

    Declaration
    public TreeGridColumnSizer(SfTreeGrid treeGrid)
    Parameters
    Type Name Description
    SfTreeGrid treeGrid

    The SfTreeGrid.

    Properties

    CheckBoxWidth

    Gets or sets the width of node check box for column width calculation when ShowCheckBox is true.

    Declaration
    public double CheckBoxWidth { get; set; }
    Property Value
    Type Description
    System.Double

    The width of the CheckBox. The default value is 24.

    ExpanderWidth

    Gets or sets the width of expander for column width calculation

    Declaration
    public double ExpanderWidth { get; set; }
    Property Value
    Type Description
    System.Double

    The width of the expander. The default value is 18.

    TreeGrid

    Gets the reference to the SfTreeGrid control.

    Declaration
    protected SfTreeGrid TreeGrid { get; }
    Property Value
    Type
    SfTreeGrid

    Methods

    CalculateAutoFitWidth(TreeGridColumn)

    Calculates the width for the column to fit the content when column sizer is Auto.

    Declaration
    protected virtual double CalculateAutoFitWidth(TreeGridColumn column)
    Parameters
    Type Name Description
    TreeGridColumn column

    The corresponding column to calculate the width when column sizer is Auto.

    Returns
    Type Description
    System.Double

    Returns the column width based on Auto column sizer.

    Remarks

    Override this method and customize the calculation of Auto column sizer.

    CalculateCellWidth(TreeGridColumn)

    Calculates the width for the column based on cell value when column sizer is SizeToCells or Auto.

    Declaration
    protected virtual double CalculateCellWidth(TreeGridColumn column)
    Parameters
    Type Name Description
    TreeGridColumn column

    The corresponding column to calculate the cell width based on cell value.

    Returns
    Type Description
    System.Double

    Returns the corresponding width for the specified column.

    Remarks

    This method is invoked when the column sizer is SizeToCells or Auto and you can customize column width calculation by overriding this method.

    CalculateExpanderColumnWidth(TreeGridColumn, Double)

    Calculate expander column width by considering expander cell, CheckBox, MinWidth and MaxWidth.

    Declaration
    protected virtual double CalculateExpanderColumnWidth(TreeGridColumn column, double width)
    Parameters
    Type Name Description
    TreeGridColumn column

    the expander column.

    System.Double width

    the column width.

    Returns
    Type Description
    System.Double

    calculated width.

    CalculateHeaderWidth(TreeGridColumn)

    Calculates the width of the column based on header text when column sizer is SizeToHeader or Auto.

    Declaration
    protected virtual double CalculateHeaderWidth(TreeGridColumn column)
    Parameters
    Type Name Description
    TreeGridColumn column

    The corresponding column to calculate its header width.

    Returns
    Type Description
    System.Double

    Returns the width of the specified column.

    Remarks

    This method is invoked when the column sizer is SizeToHeader or Auto and you can customize column width calculation by overriding this method.

    ChangeExpanderColumnWidth()

    Change expander column width based on node's level.

    Declaration
    protected virtual void ChangeExpanderColumnWidth()

    Dispose(Boolean)

    Disposes all the resources used by the TreeGridColumnSizer class.

    Declaration
    protected override void Dispose(bool isDisposing)
    Parameters
    Type Name Description
    System.Boolean isDisposing

    Indicates whether the call is from Dispose method or from a finalizer.

    Overrides
    Syncfusion.UI.Xaml.Grid.ColumnSizerBase<Syncfusion.UI.Xaml.TreeGrid.SfTreeGrid>.Dispose(System.Boolean)

    GetCellSize(Size, TreeGridColumn, TreeNode, GridQueryBounds)

    Gets the size of the cell to calculate the width of the specified column when column sizer is SizeToCells or Auto.

    Declaration
    protected virtual Size GetCellSize(Size rect, TreeGridColumn column, TreeNode node, GridQueryBounds bounds)
    Parameters
    Type Name Description
    Windows.Foundation.Size rect

    The corresponding display rectangle of the cell to measure cell size.

    TreeGridColumn column

    The corresponding column to measure its cell size.

    TreeNode node

    The corresponding node to measure the text size in cell.

    GridQueryBounds bounds

    Indicates whether the cell size is measured based on the height or width of the cell.

    Returns
    Type Description
    Windows.Foundation.Size

    Returns the size of the cell.

    GetColumnToFill()

    Gets the column to fill the remaining view port size based on AutoFillColumn or FillColumn column sizer.

    Declaration
    protected virtual TreeGridColumn GetColumnToFill()
    Returns
    Type Description
    TreeGridColumn

    the column to fill.

    GetControl(TreeGridColumn, Object)

    Gets the content presenter to measure the template when column sizer is SizeToCells or Auto.

    Declaration
    protected virtual ContentPresenter GetControl(TreeGridColumn column, object record)
    Parameters
    Type Name Description
    TreeGridColumn column

    The corresponding column to get the content presenter.

    System.Object record

    The corresponding record to get the content presenter.

    Returns
    Type Description
    Windows.UI.Xaml.Controls.ContentPresenter

    Returns the Windows.UI.Xaml.Controls.ContentPresenter for the specified column and record.

    GetDisplayText(TreeGridColumn, Object)

    Gets the display text of cell for the specified column and data.

    Declaration
    protected virtual string GetDisplayText(TreeGridColumn column, object data)
    Parameters
    Type Name Description
    TreeGridColumn column

    The corresponding column to get the display text of cell.

    System.Object data

    The corresponding record to get the display text.

    Returns
    Type Description
    System.String

    Returns the display text of the corresponding column.

    GetExpanderColumn()

    Gets the column in which expander cell is loaded.

    Declaration
    protected TreeGridColumn GetExpanderColumn()
    Returns
    Type Description
    TreeGridColumn

    the expander column.

    GetTextBlock(TreeGridColumn, Object, GridQueryBounds)

    Gets the TextBlock to measure the text when the column sizer is SizeToCells or Auto.

    Declaration
    protected virtual TextBlock GetTextBlock(TreeGridColumn column, object record, GridQueryBounds queryBounds)
    Parameters
    Type Name Description
    TreeGridColumn column

    The corresponding column to get the TextBlock.

    System.Object record

    The corresponding record to get the TextBlock.

    GridQueryBounds queryBounds

    Indicates whether the text is measured based on the height or width of the cell.

    Returns
    Type Description
    Windows.UI.Xaml.Controls.TextBlock

    Returns the TextBlock for the specified column and record.

    MeasureHeaderTemplate(TreeGridColumn, Size, GridQueryBounds)

    Measures the size of the header template for the specified column when the column sizer is SizeToHeader or Auto.

    Declaration
    protected virtual Size MeasureHeaderTemplate(TreeGridColumn column, Size rect, GridQueryBounds bounds)
    Parameters
    Type Name Description
    TreeGridColumn column

    The corresponding column to measure the header template.

    Windows.Foundation.Size rect

    The corresponding display rectangle to measure the template.

    GridQueryBounds bounds

    Indicates whether the template is measured based on the height or width of the cell.

    Returns
    Type Description
    Windows.Foundation.Size

    Returns the size of the header template for the specified column.

    MeasureTemplate(Size, Object, TreeGridColumn, GridQueryBounds)

    Measures the size of the template when the column sizer is SizeToCells or Auto.

    Declaration
    protected virtual Size MeasureTemplate(Size rect, object record, TreeGridColumn column, GridQueryBounds bounds)
    Parameters
    Type Name Description
    Windows.Foundation.Size rect

    The corresponding display rectangle to measure the template.

    System.Object record

    The corresponding record to measure the template.

    TreeGridColumn column

    The corresponding column to measure the template.

    GridQueryBounds bounds

    Indicates whether the template is measured based on the height or width of the cell.

    Returns
    Type Description
    Windows.Foundation.Size

    Returns the size of template.

    MeasureText(Size, String, TreeGridColumn, Object, GridQueryBounds)

    Measures the text of the specified column when the column sizing is SizeToCells or Auto.

    Declaration
    protected virtual Size MeasureText(Size rectangle, string displayText, TreeGridColumn column, object record, GridQueryBounds queryBounds)
    Parameters
    Type Name Description
    Windows.Foundation.Size rectangle

    The corresponding display rectangle to measure the text.

    System.String displayText

    The displayText to measure.

    TreeGridColumn column

    The corresponding column to measure the text.

    System.Object record

    The corresponding record to measure the text.

    GridQueryBounds queryBounds

    Indicates whether the text is measured based on the height or width of the cell.

    Returns
    Type Description
    Windows.Foundation.Size

    Returns the size of text.

    OnTreeColumnPropertyChanged(TreeGridColumn, String)

    Invoked when the TreeGridColumn property value changes.

    Declaration
    protected virtual void OnTreeColumnPropertyChanged(TreeGridColumn column, string propertyName)
    Parameters
    Type Name Description
    TreeGridColumn column

    The corresponding column on which the property value changes.

    System.String propertyName

    The name of property that value has been changed.

    Refresh()

    Refreshes column widths when the ColumnSizer property value changes at SfTreeGrid or TreeGridColumn level.

    Declaration
    public void Refresh()

    Refresh(Double)

    Refreshes the column width when the ColumnSizer property value changes at SfTreeGrid or TreeGridColumn level.

    Declaration
    protected virtual void Refresh(double viewPortWidth)
    Parameters
    Type Name Description
    System.Double viewPortWidth

    The available width to refresh the column width.

    SetColumnWidth(TreeGridColumn, Double)

    Sets the width for the specified column based on MinimumWidth and MaximumWidth property value changes.

    Declaration
    public virtual double SetColumnWidth(TreeGridColumn column, double Width)
    Parameters
    Type Name Description
    TreeGridColumn column

    The corresponding column to set the width.

    System.Double Width

    The corresponding width to set.

    Returns
    Type Description
    System.Double

    Returns the corresponding width for the specified column.

    SetNoneWidth(TreeGridColumn, Double)

    Sets the width for the specified column based on None column sizer.

    Declaration
    protected virtual double SetNoneWidth(TreeGridColumn column, double width)
    Parameters
    Type Name Description
    TreeGridColumn column

    The corresponding column to set None width.

    System.Double width

    The width to set as None width.

    Returns
    Type Description
    System.Double

    Returns the None width for the specified column.

    SetStarWidth(Double, IEnumerable<TreeGridColumn>)

    Sets the column width based on Star column sizer.

    Declaration
    protected virtual void SetStarWidth(double remainingColumnWidth, IEnumerable<TreeGridColumn> remainingColumns)
    Parameters
    Type Name Description
    System.Double remainingColumnWidth

    The available width to adjust the column based on Star column sizer.

    System.Collections.Generic.IEnumerable<TreeGridColumn> remainingColumns

    The collection columns that need to be set star width.

    Remarks

    Override this method to customize the Star width calculation in SfTreeGrid.

    Implements

    System.IDisposable

    Extension Methods

    DateTimeExtension.ToDateTime(Object)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved