menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ColumnSizerBase<T> - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ColumnSizerBase<T>

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

    Inheritance
    System.Object
    ColumnSizerBase<T>
    GridColumnSizer
    TreeGridColumnSizer
    Implements
    System.IDisposable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.UI.Xaml.Grid
    Assembly: Syncfusion.SfGrid.WPF.dll
    Syntax
    public class ColumnSizerBase<T> : IDisposable where T : SfGridBase
    Type Parameters
    Name
    T

    Constructors

    ColumnSizerBase()

    Declaration
    public ColumnSizerBase()

    Fields

    FontFamilyProperty

    Identifies the Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontFamily dependency property.

    Declaration
    public static readonly DependencyProperty FontFamilyProperty
    Field Value
    Type
    System.Windows.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontFamily dependency property.

    FontSizeProperty

    Identifies the Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontSize dependency property.

    Declaration
    public static readonly DependencyProperty FontSizeProperty
    Field Value
    Type
    System.Windows.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontSize dependency property.

    FontStretchProperty

    Identifies the Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontStretch dependency property.

    Declaration
    public static readonly DependencyProperty FontStretchProperty
    Field Value
    Type
    System.Windows.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontStretch dependency property.

    FontWeightProperty

    Identifies the Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontWeight dependency property.

    Declaration
    public static readonly DependencyProperty FontWeightProperty
    Field Value
    Type
    System.Windows.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontWeight dependency property.

    MarginProperty

    Identifies the Syncfusion.UI.Xaml.Grid.GridColumnSizer.Margin dependency property.

    Declaration
    public static readonly DependencyProperty MarginProperty
    Field Value
    Type
    System.Windows.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.Grid.GridColumnSizer.Margin dependency property.

    Properties

    AllowMeasureTextByFormattedText

    Gets or sets a value that indicates whether the column width is measured based on formatted text.

    Declaration
    public bool AllowMeasureTextByFormattedText { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the column width is calculated based on the formatted text; otherwise, false.

    AutoFitMode

    Gets or sets a value that indicates the mode for calculating the width of the cell based on cell content. SmartFit calculates the column width in optimized way.

    Declaration
    public AutoFitMode AutoFitMode { get; set; }
    Property Value
    Type Description
    AutoFitMode

    One of the AutoFitMode enumeration that specifies the way to measure the width of the corresponding column. The default value is SmartFit.

    Control

    Gets or sets the control to measure the template for column sizing calculation.

    Declaration
    protected virtual ContentControl Control { get; set; }
    Property Value
    Type Description
    System.Windows.Controls.ContentControl

    The System.Windows.Controls.ContentControl to measure the template for column sizing calculation.

    FontFamily

    Gets or sets the FontFamily to compute the column width.

    Declaration
    public FontFamily FontFamily { get; set; }
    Property Value
    Type Description
    System.Windows.Media.FontFamily

    The FontFamily to compute the column width. The default value is Segoe UI.

    Remarks

    By default the column width calculation based on fixed font family. When the font family is customized, that is need to be initialized to this property for customizing column sizer calculation based on new font family.

    FontSize

    Gets or sets the font size to compute the column width.

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

    The size of the font. The default value is 12.

    Remarks

    By default the column width calculation based on fixed font size. When the font size is customized, that is need to be initialized to this property for customizing column sizer calculation based on new font size.

    FontStretch

    Gets or sets the FontStretch to compute the column width.

    Declaration
    public FontStretch FontStretch { get; set; }
    Property Value
    Type Description
    System.Windows.FontStretch

    The FontStretch to compute the column width.

    Remarks

    By default the column width calculation based on fixed FontStretch. When the FontStretch is customized, that is need to be initialized to this property for customizing column sizer calculation based on new FontStretch.

    FontWeight

    Gets or sets the FontWeight to compute the column width.

    Declaration
    public FontWeight FontWeight { get; set; }
    Property Value
    Type Description
    System.Windows.FontWeight

    The FontWeight to compute the column width.

    Remarks

    By default the column width calculation based on fixed FontWeight. When the FontWeight is customized, that is need to be initialized to this property for customizing column sizer calculation based on new FontWeight.

    Margin

    Gets or sets the margin to compute the column width.

    Declaration
    public Thickness Margin { get; set; }
    Property Value
    Type Description
    System.Windows.Thickness

    The margin to compute the column width.

    Remarks

    By default the column width calculation based on fixed margin. When the margin is customized, that is need to be initialized to this property for customizing column sizer calculation based on new margin.

    SortIconWidth

    Gets or sets the width of sort icon for column sizing calculation..

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

    The width of the sort icon. The default value is 25.

    Remarks

    The SizeToHeader and Auto type of column sizer calculates the column width based on static sort icon width. When the sort icon width is customized, that is need to be initialized to this property for customizing column sizer calculation based on new sort icon width.

    TextBlock

    Gets or sets the TextBlock to measure the text for column sizing calculation.

    Declaration
    protected virtual TextBlock TextBlock { get; set; }
    Property Value
    Type Description
    System.Windows.Controls.TextBlock

    The to measure the text for column sizing calculation.

    Methods

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

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

    GetFontFamily(GridColumnBase)

    Gets the value of property for the specified column.

    Declaration
    public static FontFamily GetFontFamily(GridColumnBase column)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to get the font family.

    Returns
    Type
    System.Windows.Media.FontFamily
    Remarks

    The specified font family is considered for column sizing calculation only.

    GetFontSize(GridColumnBase)

    Gets the value of property for the specified column.

    Declaration
    public static double GetFontSize(GridColumnBase column)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to get the font size.

    Returns
    Type
    System.Double
    Remarks

    The specified font size is considered for column sizing calculation only.

    GetFontStretch(GridColumnBase)

    Gets the value of property for the specified column.

    Declaration
    public static FontStretch GetFontStretch(GridColumnBase column)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to get the font stretch.

    Returns
    Type
    System.Windows.FontStretch
    Remarks

    The specified font stretch is considered for column sizing calculation only.

    GetFontWeight(GridColumnBase)

    Gets the value of property for the specified column.

    Declaration
    public static FontWeight GetFontWeight(GridColumnBase column)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to get the font weight.

    Returns
    Type
    System.Windows.FontWeight
    Remarks

    The specified font weight is considered for column sizing calculation only.

    GetMargin(GridColumnBase)

    Gets the value of property for the specified column.

    Declaration
    public static Thickness GetMargin(GridColumnBase column)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to get the margin.

    Returns
    Type
    System.Windows.Thickness
    Remarks

    The specified margin is considered for column sizing calculation only.

    ResetAutoCalculation(GridColumnBase)

    Resets the auto width for the specified column.

    Declaration
    public void ResetAutoCalculation(GridColumnBase column)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to reset the auto width.

    Remarks

    The column width is reset to double.Nan ,if the column sizing is need to recalculate based on the data.

    Exceptions
    Type Condition
    System.InvalidOperationException

    Thrown when the column is null.

    ResetAutoCalculationforAllColumns()

    Resets Auto width calculation for all the columns.

    Declaration
    public void ResetAutoCalculationforAllColumns()
    Remarks

    The column width is reset to double.Nan for all columns ,if the column sizing is need to recalculate based on the data.

    Resume()

    Resumes the auto sizing operation.

    Declaration
    public void Resume()

    SetFontFamily(GridColumnBase, FontFamily)

    Sets the value of property for the specified column.

    Declaration
    public static void SetFontFamily(GridColumnBase column, FontFamily value)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to set the font family.

    System.Windows.Media.FontFamily value

    The desired font family to set.

    Remarks

    The specified font family is considered for column sizing calculation only.

    SetFontSize(GridColumnBase, Double)

    Sets the value of property for the specified column.

    Declaration
    public static void SetFontSize(GridColumnBase column, double value)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to set the font size to its text content.

    System.Double value

    The desired font size.

    Remarks

    The specified font size is considered for column sizing calculation only.

    SetFontStretch(GridColumnBase, FontStretch)

    Sets the value of property for the specified column.

    Declaration
    public static void SetFontStretch(GridColumnBase column, FontStretch value)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to set the font stretch.

    System.Windows.FontStretch value

    The desired font stretch value.

    Remarks

    The specified font stretch is considered for column sizing calculation only.

    SetFontWeight(GridColumnBase, FontWeight)

    Sets the value of property for the specified column.

    Declaration
    public static void SetFontWeight(GridColumnBase column, FontWeight value)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to set the font weight.

    System.Windows.FontWeight value

    The desired font weight.

    Remarks

    The specified font weight is considered for column sizing calculation only.

    SetMargin(GridColumnBase, Thickness)

    Sets the value of property for the specified column.

    Declaration
    public static void SetMargin(GridColumnBase column, Thickness value)
    Parameters
    Type Name Description
    GridColumnBase column

    The corresponding column to set the margin.

    System.Windows.Thickness value

    The desired margin to set.

    Remarks

    The specified margin is considered for column sizing calculation only.

    Suspend()

    Suspends the auto sizing operation.

    Declaration
    public void Suspend()

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved