menu

Xamarin.Forms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridColumn - Xamarin.Forms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class GridColumn

    Serves as the base class for the different column types of the SfDataGrid control.

    Inheritance
    System.Object
    GridColumn
    GridComboBoxColumn
    GridDateTimeColumn
    GridEditorColumn
    GridImageColumn
    GridPickerColumn
    GridSwitchColumn
    GridTemplateColumn
    GridTextColumn
    Implements
    System.IDisposable
    Namespace: Syncfusion.SfDataGrid.XForms
    Assembly: Syncfusion.SfDataGrid.XForms.dll
    Syntax
    public abstract class GridColumn : BindableObject, IDisposable
    Remarks

    This abstract class provides the base functionality for all SfDataGrid columns.

    Constructors

    GridColumn()

    Initializes a new instance of the GridColumn class.

    Declaration
    public GridColumn()

    Fields

    ActualWidthProperty

    Identifies the ActualWidth Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty ActualWidthProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    AllowEditingProperty

    Identifies the AllowEditing Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty AllowEditingProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    AllowFocusProperty

    Identifies the AllowFocusXamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty AllowFocusProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    AllowSortingProperty

    Identifies the AllowSorting Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty AllowSortingProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    CellStyleProperty

    Identifies the CellStyle Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty CellStyleProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    CellTextSizeProperty

    Identifies the CellTextSize Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty CellTextSizeProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    ColumnSizerProperty

    Identifies the ColumnSizer Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty ColumnSizerProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    CultureInfoProperty

    Identifies the Culture Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty CultureInfoProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    FontAttributeProperty

    Identifies the FontAttribute Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty FontAttributeProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    FormatProperty

    Identifies the Format Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty FormatProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    GroupModeProperty

    Identifies the GroupMode Xamarin.Forms.BindableProperty.

    Declaration
    public readonly BindableProperty GroupModeProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    HeaderCellTextSizeProperty

    Identifies the HeaderCellTextSize Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty HeaderCellTextSizeProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    HeaderFontAttributeProperty

    Identifies the HeaderFontAttribute Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty HeaderFontAttributeProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    HeaderFontProperty

    Identifies the HeaderFont Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty HeaderFontProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    HeaderTemplateProperty

    Identifies the HeaderTemplate Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty HeaderTemplateProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    HeaderTextAlignmentProperty

    Identifies the HeaderTextAlignment Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty HeaderTextAlignmentProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    HeaderTextProperty

    Identifies the HeaderText Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty HeaderTextProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    IsHiddenProperty

    Identifies the IsHidden Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty IsHiddenProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    LineBreakModeProperty

    Identifies the LineBreakMode Xamarin.Forms.BindableProperty.

    Declaration
    public readonly BindableProperty LineBreakModeProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    MappingNameProperty

    Identifies the MappingName Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty MappingNameProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#mappingname

    MaximumWidthProperty

    Identifies the MaximumWidth Xamarin.Forms.BindableProperty. property.

    Declaration
    public static readonly BindableProperty MaximumWidthProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    MinimumWidthProperty

    Identifies the MinimumWidth Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty MinimumWidthProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    PaddingProperty

    Identifies the Padding Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty PaddingProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    RecordFontProperty

    Identifies the RecordFont Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty RecordFontProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    SortModeProperty

    Identifies the SortModeXamarin.Forms.BindableProperty.

    Declaration
    public readonly BindableProperty SortModeProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    TextAlignmentProperty

    Identifies the TextAlignment Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty TextAlignmentProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    WidthProperty

    Identifies the Width Xamarin.Forms.BindableProperty.

    Declaration
    public static readonly BindableProperty WidthProperty
    Field Value
    Type
    Xamarin.Forms.BindableProperty
    Remarks

    This Xamarin.Forms.BindableProperty is read-only.

    Properties

    ActualWidth

    Gets the current width of the column in device independent unit.

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

    The current width of the column in device independent unit.

    AllowEditing

    Gets or sets a value indicating whether to enable/disable editing for a column. The user can enable or disable editing for particular column by using this property.

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

    True if editing for the column is enabled, otherwise false. The default value is false.

    Examples
    GridTextColumn column = new GridTextColumn();
    column.AllowEditing = false;
    dataGrid.Columns.Add(column);
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/editing#column-editing

    AllowFocus

    Gets or sets a value indicating whether the cells of the column are enabled for user interaction like selection, editing etc.

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

    true If the user allows interactions like selection and editing for the column; otherwise, false. The default value is true.

    AllowSorting

    Gets or sets a value indicating whether the column can be sorted or not.

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

    True if sorting for the column is enabled, otherwise false. The default value is true.

    Remarks

    SfDataGrid allows sorting for the column only when both AllowSorting and AllowSorting is true. This enables the user to restrict a particular column from being sorted by setting AllowSorting as false.

    Examples
    GridTextColumn column = new GridTextColumn();
    column.AllowSorting = false;
    dataGrid.Columns.Add(column);

    CellStyle

    Gets or sets the style that is used to render the cells in the column. SfDataGrid allows you to apply cell styles for a GridColumn that is used to render the cells in that column.

    Declaration
    public Style CellStyle { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.Style

    The style that is used to render the cells in the column.

    Remarks

    SfDataGrid allows you to apply cell styles for a GridColumn that is used to render the cells in that column. When cell style is applied, the GridCell appears in the custom style rather than the default one.

    Examples
    <syncfusion:SfDataGrid ItemsSource={Binding OrdersInfo}>
    <syncfusion:GridTextColumn MappingName="Freight" Format="C">
        <syncfusion:GridTextColumn.CellStyle>
            <Style TargetType = "syncfusion:GridCell" >
                <Setter Property="Foreground" Value="Red" />
            </Style>
        </syncfusion:GridTextColumn.CellStyle>
    </syncfusion:GridTextColumn>
    </syncfusion:SfDataGrid>
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/conditional-styles

    CellTextSize

    Gets or sets the font size for the Content of record cells in the column. The font size for the Content of record cells in the GridColumn can be customized by using this property.

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

    The FontSize for the Content of record cells in the column. The default value is 14.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        CellTextSize = 12
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#celltextsize

    CellType

    Gets or sets a value indicating the cell type of the GridColumn. This property is used to identify the type of the column. This property must be specified with a string value when creating a custom column extending from the base class.

    Declaration
    public string CellType { get; protected set; }
    Property Value
    Type Description
    System.String

    The CellType of the GridColumn.

    Remarks

    SfDataGrid enables the user to create their own column type when the available column type does not meet his requirements. The user must set the CellType of the grid column to the type of UIElement to be loaded in the grid cell. It is mandatory to create a custom cell renderer for the custom column created and it must be added in the CellRenderers collection. The user can handle his customizations in the custom renderer class implementing the GridVirtualizingCellRenderer<T1, T2>.

    Examples
    StepperColumn stepperColumn = new StepperColumn();
    stepperColumn.MappingName = "OrderID";
    dataGrid.Columns.Add(stepperColumn);
    
    dataGrid.CellRenderers.Add("Stepper", new StepperColumnRenderer());
    
    //StepperColumn.cs
    public class StepperColumn : GridColumn
    {
    
        public StepperColumn()
        {
            CellType = "Stepper";
        }
    
    }
    
    //StepperColumnRenderer.cs
    public class StepperColumnRenderer : GridVirtualizingCellRenderer<Stepper,Stepper>
    {
    
    }

    ColumnSizer

    Gets or sets the value that indicates how the column width is determined.

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

    One of the ColumnSizer enumeration that adjust the column width. The default value is None.

    Examples
    GridNumericColumn numericColumn = new GridNumericColumn();
    numericColumn.ColumnSizer = ColumnSizer.Star;
    dataGrid.Columns.Add(numericColumn);

    CultureInfo

    Gets or sets the culture used for formatting the Content of record cells in the column. SfDataGrid enables the user to apply different culture to the records in the cells by setting this property.

    Declaration
    public CultureInfo CultureInfo { get; set; }
    Property Value
    Type Description
    System.Globalization.CultureInfo

    The Culture used for formatting the Content of record cells in the column.

    Remarks

    SfDataGrid allows you to apply different System.Globalization.CultureInfo for the GridColumns by using this property. Assign the FormatString to this property based on the type of the property the column is associated with to format the value. The user can use different StringFormats to customize the value displayed in the record cells.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        Format = "C",
        CultureInfo = new CultureInfo("en-US")
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#formatting-gridtextcolumn-with-different-culture

    DisplayBinding

    Gets or sets the display binding that associates the column with a property in the data source. The value of the property in the underlying model object bound to the Display binding will be the Content of the grid cell in normal mode. When the grid cell is entered into edit mode, The value of the property in the underlying model object bound to the ValueBinding will be the Content of the grid cell.

    Declaration
    public BindingBase DisplayBinding { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.BindingBase

    The display binding that associates the column with a property in the data source.

    Remarks

    The display Content of GridColumn is determined from DisplayBinding property. It gets and sets the binding that associates the GridColumn with a property in the data source. While setting MappingName alone to the SfDataGrid, the DisplayBinding will be automatically generated based on the MappingName.

    Examples
    <syncfusion:SfDataGrid.Columns>
        <syncfusion:GridTextColumn MappingName = "CustomerID"
                                   DisplayBinding="{Binding OrderID}"
                                   />
    </syncfusion:SfDataGrid.Columns>
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#binding-options

    FontAttribute

    Gets or sets the Xamarin.Forms.FontAttributes that describes the font attribute for the Content of the record cells in the GridColumn. SfDataGrid enables the user to apply different font attributes to the Content of the record cells using this property. The record cells text can be customized as bold or Italic using this property.

    Declaration
    public FontAttributes FontAttribute { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.FontAttributes

    Represents the Xamarin.Forms.FontAttributes that describes the font attribute for the Content of the record cell in the column. The default value is Xamarin.Forms.FontAttributes.None.

    Examples
    dataGrid.Columns.Add (new GridTextColumn ()
    { 
        MappingName = "Freight",
        FontAttribute = FontAttribute.Bold
        });

    Format

    Gets or sets a value that indicates the format applied for the Content of record cells in the column. SfDataGrid enables the user to apply Format for the records in the cells by setting this property.

    SfDataGrid enables the user to populate the data for the GridUnboundColumn using this property. This property enables the user to format the values of other columns and display the formatted value in unbound column.

    Declaration
    public string Format { get; set; }
    Property Value
    Type Description
    System.String

    The format applied to the record in the cells.

    Remarks

    SfDataGrid enables the user to apply Format for the records in the cells by setting this property. Assign the FormatString to this property based on the type of the property the GridColumn is associated with to format the value.

    SfDataGrid enables the user to populate the data for the GridUnboundColumn using this property. This property enables the user to format the values of other columns and display the formatted value in unbound column.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "ShippingDate",
        Format = "dd/MM/yyyy"
        });
    GridUnboundColumn DiscountColumn = new GridUnboundColumn()
    {
        MappingName = "DiscountPrice",
        HeaderText = "Discount Price",
        Format = "'{Discount}% for {OrderID}'"
    };
    dataGrid.Columns.Add(DiscountColumn);
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#formatting
    https://help.syncfusion.com/xamarin/sfdatagrid/unbound-column#using-format

    GroupMode

    Gets or sets a value that decides whether grouping is processed based on display value or edit value or value in the underlying collection of the column.

    Declaration
    public DataReflectionMode GroupMode { get; set; }
    Property Value
    Type Description
    DataReflectionMode

    The DataReflectionMode that decides whether grouping is processed based on display value or edit value or value in the underlying collection of the column. The default value is Default.

    Remarks

    By default, column grouping occurs based on the value in the underlying collection thereby creating a new group for each new value of that column. SfDataGrid also allows the user to group a column either on the display value or edit value of the column using this property.

    Examples
    GridNumericColumn cargoWeight = new GridTextColumn();
    cargoWeight.MappingName = "ShipmentWeight";
    cargoWeight.GroupMode = Syncfusion.Data.DataReflectionMode.Display;
    cargoWeight.Format = "#";
    dataGrid.Columns.Add(cargoWeight);
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/grouping#groupmode

    HeaderCellTextSize

    Gets or sets the font size for the Content of header cell in the column. The default value is 14. The font size for the Content of header cell in the GridColumn can be customized by using the this property.

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

    The font size for the Content of header cell in the column. The default value is 14.

    Remarks

    The font size for the Content of header cell in the GridColumn can be customized by using the this property. However this property will not work if HeaderTemplate is used for a column.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        HeaderCellTextSize = 16
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#headercelltextsize

    HeaderFont

    Gets or sets the font family for the Content of header cell in the column. The font family for the Content of header cells in the GridColumn can be customized by using this property.

    Declaration
    public string HeaderFont { get; set; }
    Property Value
    Type Description
    System.String

    The FontFamily for the Content of header cell in the column. The default value is "HelveticaNeue LT 55 Roman".

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        HeaderFont = "Helvetica Neue"
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#headerfont

    HeaderFontAttribute

    Gets or sets the Xamarin.Forms.FontAttributes that describes the font style for the Content of the header cell in the column. SfDataGrid enables the user to apply different font attributes to the Content of the header cells using this property. The header text can be customized as bold or Italic using this property.

    Declaration
    public FontAttributes HeaderFontAttribute { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.FontAttributes

    Represents the Xamarin.Forms.FontAttributes that describes the font style for the Content of the header cell in the column. The default value is Xamarin.Forms.FontAttributes.None.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        HeaderFontAttribute = FontAttributes.Bold;
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#headerfontattribute

    HeaderTemplate

    Gets or sets the template used to display the header of the current column. SfDataGrid allows you to customize the header cell based on your requirement by using this property.

    Declaration
    public DataTemplate HeaderTemplate { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.DataTemplate

    The template used to display the header of the current column.

    Examples
    <syncfusion:SfDataGrid ItemsSource="{Binding OrderInfo}">
    <syncfusion:SfDataGrid.Columns>
    <syncfusion:GridTextColumn MappingName="OrderID">
      <syncfusion:GridTextColumn.HeaderTemplate>
        <DataTemplate>
            <Label Text="OrderID" TextColor="Black" 
                   BackgroundColor="Yellow" YAlign="Center" />
        </DataTemplate>
      </syncfusion:GridTextColumn.HeaderTemplate>
    </syncfusion:GridTextColumn>
    </syncfusion:SfDataGrid.Columns>
    </syncfusion:SfDataGrid>
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#headertemplate

    HeaderText

    Gets or sets the display text of the column header.

    Declaration
    public string HeaderText { get; set; }
    Property Value
    Type Description
    System.String

    The display text of the column header. The default value of header text is the MappingName of the column.

    Examples
    GridTextColumn column = new GridTextColumn();
    column.MappingName = "OrderID";
    column.HeaderText = "Order ID";
    dataGrid.Columns.Add(column);
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#headertext

    HeaderTextAlignment

    Gets or sets the Xamarin.Forms.TextAlignment for the header cell in the column. The default alignment for the header cells in SfDataGrid is center and you can customize this to Start or End.

    Declaration
    public TextAlignment HeaderTextAlignment { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.TextAlignment

    The Xamarin.Forms.TextAlignment for the header cell in the column. The default value is Xamarin.Forms.TextAlignment.Center.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        HeaderTextAlignment = TextAlignment.Start;
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#headertextalignment

    IsHidden

    Gets or sets a value indicating whether the visibility of the column. SfDataGrid allows you to hide a particular column using this property or not.

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

    True if the column is hidden, otherwise false. The default value is false.

    Remarks

    SfDataGrid allows you to hide a particular column by two ways, the user can either set IsHidden property as true or set Width as 0.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        IsHidden = true
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#ishidden

    LineBreakMode

    Gets or sets the Xamarin.Forms.LineBreakMode for the cells in the column. The user can customize the line breaking mode of SfDataGrid by using this property. By default, the word will be wrapped in the record cells, when the text for the record cells exceeds the Content area.

    Declaration
    public LineBreakMode LineBreakMode { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.LineBreakMode

    The Xamarin.Forms.LineBreakMode for the cells in the column. The default value is Xamarin.Forms.LineBreakMode.WordWrap.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        LineBreakMode = LineBreakMode.NoWrap;
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#linebreakmode

    LoadUIView

    Gets or sets a value indicating whether to load UIView or draw cell value in Android.

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

    True if UIView is loaded in the grid cell, otherwise false. The default value is false for Android platform and true for other platforms.

    Remarks

    By default, SfDataGrid draws the value in the cell for Android platform, and loads the UIElement in other platforms. The user can customize the SfDataGrid to load the UIElement for android platform, by setting LoadUIView as true.

    Examples
    GridTextColumn column = new GridTextColumn();
    column.LoadUIView = true;
    dataGrid.Columns.Add(column);

    MappingName

    Gets or sets the mapping name that associates the column with a property in the bound data source.

    Declaration
    public string MappingName { get; set; }
    Property Value
    Type Description
    System.String

    The mapping name that associates the column with a property in the data source.

    Examples
    GridTextColumn column = new GridTextColumn();
    column.MappingName = "OrderID";
    dataGrid.Columns.Add(column);
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#mappingname

    MaximumWidth

    Gets or sets the upper bound for the width of the column.

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

    The maximum width constraint of the column. The default value is double.NaN.

    Remarks

    When AllowResizingColumn is enabled, the column can be resized from MinimumWidth to MaximumWidth. Hence, using this property the user can restrict the maximum width the column can be resized.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        MaximumWidth = 200
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/columns#resizing-columns

    MinimumWidth

    Gets or sets the lower bound for the width of the column.

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

    The minimum width constraint of the column. The default value is 20d .

    Remarks

    When AllowResizingColumn is enabled, the column can be resized from MinimumWidth to MaximumWidth. Hence, using this property the user can restrict the minimum width the column can be resized.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        MinimumWidth = 30
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/columns#resizing-columns

    Padding

    Gets or sets the padding applied to the cells in the column.

    Declaration
    public Thickness Padding { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.Thickness

    The padding applied to the cells in the column.

    Examples
    GridTextColumn column = new GridTextColumn();
    column.Padding = new Thickness(10,5,10,5);
    dataGrid.Columns.Add(column);

    RecordFont

    Gets or sets the font family for the Content of record cells in the column. The font family for the Content of record cells in the GridColumn can be customized by using this property.

    Declaration
    public string RecordFont { get; set; }
    Property Value
    Type Description
    System.String

    The font family for the Content of record cells in the column. The default value is "Helvetica Neue".

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        RecordFont = "HelveticaNeue LT 55 Roman"
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#recordfont

    SortMode

    Gets or sets a value that decides whether sorting calculation is processed based on display value in case of indexer and complex properties or default value in case of CLR properties.

    Declaration
    public DataReflectionMode SortMode { get; set; }
    Property Value
    Type Description
    DataReflectionMode

    The DataReflectionMode that decides whether sorting calculation is processed based on display value or default value. The default value is Default.

    Remarks

    By default, the sorting for the column will be calculated using DataReflectionMode Default only. For complex properties use DataReflectionMode.Display to fetch values using custom logic. For simple CLR properties use DataReflectionMode.Default to fetch values using default logic.

    Examples
    GridTextColumn cargoWeight = new GridTextColumn();
    cargoWeight.MappingName = "ShipmentWeight";
    cargoWeight.SortMode = Syncfusion.Data.DataReflectionMode.Display;
    dataGrid.Columns.Add(cargoWeight);

    TextAlignment

    Gets or sets the Xamarin.Forms.TextAlignment for the record cells in the column. The default alignment for the record cells in SfDataGrid is center and you can customize this to Start or End.

    Declaration
    public TextAlignment TextAlignment { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.TextAlignment

    The Xamarin.Forms.TextAlignment for the record cells in the column. The default value is Xamarin.Forms.TextAlignment.Center.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        TextAlignment = TextAlignment.Start;
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#textalignment

    ValueBinding

    Gets or sets the value binding that associates the column with a property in the data source. The value of the property in the underlying model object bound to the value binding will be the Content of the grid cell in edit mode.

    Declaration
    public BindingBase ValueBinding { get; set; }
    Property Value
    Type Description
    Xamarin.Forms.BindingBase

    The value binding that associates the column with a property in the data source.

    Remarks

    The SfDataGrid enables the user to display a different property as the Content of the grid cell, when the grid cell enters into edit mode. If the user wants to display a different property in edit mode, the user can make use of this property. While setting MappingName alone to the SfDataGrid, the ValueBinding will be automatically generated based on the MappingName.

    Examples
    <syncfusion:SfDataGrid.Columns>
        <syncfusion:GridTextColumn MappingName = "CustomerID"
                                   DisplayBinding = "CustomerID"
                                   ValueBinding="{Binding OrderID}"
                                   />
    </syncfusion:SfDataGrid.Columns>

    Width

    Gets or sets the column width. The user can customize the column width by using this property. By default, this property will not be assigned any value and the GridColumn renders in view based on the value of DefaultColumnWidth property.

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

    The width of the column. The default value is System.Double.NaN.

    Examples
    dataGrid.Columns.Add (new GridTextColumn () { 
        MappingName = "Freight",
        Width = 100
        });
    See Also
    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#column-width

    Methods

    CanEditCell()

    Determines whether the column is editable.

    Declaration
    protected virtual bool CanEditCell()
    Returns
    Type Description
    System.Boolean

    Returns true if all the cells with in the column is editable .

    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.

    GetFormattedValue(Object)

    Gets the Formatted value for the Content of a record cell in the column based on the Format and CultureInfo of the column.

    Declaration
    public virtual object GetFormattedValue(object value)
    Parameters
    Type Name Description
    System.Object value

    The actual value of the record cell in the column.

    Returns
    Type Description
    System.Object

    The formatted value based on the Format and CultureInfo properties of the column.

    SetDisplayBindingConverter()

    Sets the converter for the DisplayBinding of column.

    Declaration
    protected virtual void SetDisplayBindingConverter()
    Remarks

    You can override this method to specify the converter for DisplayBinding.

    Implements

    System.IDisposable

    See Also

    https://help.syncfusion.com/xamarin/sfdatagrid/column-types#gridcolumn
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved