Class DataGridColumn
Represents the base class for the different column types of the SfDataGrid control.
Inheritance
Implements
Namespace: Syncfusion.Maui.DataGrid
Assembly: Syncfusion.Maui.DataGrid.dll
Syntax
public abstract class DataGridColumn : BindableObject, IDisposable
Constructors
DataGridColumn()
Initializes a new instance of the DataGridColumn class.
Declaration
public DataGridColumn()
Fields
ActualWidthProperty
Identifies the ActualWidth Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ActualWidthProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
AllowEditingProperty
Identifies the AllowEditing Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowEditingProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
AllowFocusProperty
Identifies the AllowFocusMicrosoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowFocusProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
AllowSortingProperty
Identifies the AllowSorting Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty AllowSortingProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
CellPaddingProperty
Identifies the CellPadding Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty CellPaddingProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
CellStyleProperty
Identifies the CellStyle Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty CellStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
CellTextAlignmentProperty
Identifies the CellTextAlignment Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty CellTextAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ColumnWidthModeProperty
Identifies the ColumnWidthMode Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty ColumnWidthModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
CultureInfoProperty
Bindable property for CultureInfo
Declaration
public static readonly BindableProperty CultureInfoProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
FormatProperty
Identifies the Format Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty FormatProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
GroupModeProperty
Identifies the GroupModeMicrosoft.Maui.Controls.BindableProperty
Declaration
public readonly BindableProperty GroupModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
HeaderLineBreakModeProperty
Identifies the HeaderLineBreakMode bindable property.
Declaration
public static readonly BindableProperty HeaderLineBreakModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
The HeaderLineBreakMode property determines the line break mode for header cell.
HeaderPaddingProperty
Identifies the HeaderPadding Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty HeaderPaddingProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
HeaderStyleProperty
Identifies the CellStyle Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty HeaderStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
HeaderTemplateProperty
Identifies the HeaderTemplate Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty HeaderTemplateProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
HeaderTextAlignmentProperty
Identifies the HeaderTextAlignment Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty HeaderTextAlignmentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
HeaderTextProperty
Identifies the HeaderText Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty HeaderTextProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
LineBreakModeProperty
Bindable property for LineBreakMode
Declaration
public static readonly BindableProperty LineBreakModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MappingNameProperty
Identifies the MappingName Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty MappingNameProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
MaximumWidthProperty
Identifies the MaximumWidth Microsoft.Maui.Controls.BindableProperty. property.
Declaration
public static readonly BindableProperty MaximumWidthProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
MinimumWidthProperty
Identifies the MinimumWidth Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty MinimumWidthProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
SortModeProperty
Identifies the SortModeMicrosoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty SortModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
UseBindingValueProperty
Identifies the UseBindingValue bindable property.
Declaration
public static readonly BindableProperty UseBindingValueProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
VisibleProperty
Identifies the IsHidden Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty VisibleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
WidthProperty
Identifies the Width Microsoft.Maui.Controls.BindableProperty.
Declaration
public static readonly BindableProperty WidthProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Remarks
This Microsoft.Maui.Controls.BindableProperty is read-only.
Properties
ActualWidth
The actual display width of the column when auto fitted.
Declaration
public double ActualWidth { get; }
Property Value
Type |
---|
System.Double |
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 |
---|
System.Boolean |
AllowFocus
Gets or sets the value indicating whether the cells of the column can be enabled for the current cell focus.
Declaration
public bool AllowFocus { get; set; }
Property Value
Type |
---|
System.Boolean |
AllowSorting
Gets or sets a value indicating whether a column can be sorted.
Declaration
public bool AllowSorting { get; set; }
Property Value
Type |
---|
System.Boolean |
See Also
CellPadding
Gets or sets the inner padding of the cell.
Declaration
public Thickness CellPadding { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Thickness |
CellStyle
Gets or sets the style that is used to render the cells in a column.
Declaration
public Style CellStyle { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.Style |
CellTextAlignment
Gets or sets the alignment for the rows.
Declaration
public TextAlignment CellTextAlignment { get; set; }
Property Value
Type |
---|
Microsoft.Maui.TextAlignment |
CellType
Gets or sets the cell type of the DataGridColumn.
Declaration
public string CellType { get; protected set; }
Property Value
Type |
---|
System.String |
ColumnWidthMode
Gets or sets the value that indicates how the column width is determined.
Declaration
public ColumnWidthMode ColumnWidthMode { get; set; }
Property Value
Type | Description |
---|---|
ColumnWidthMode | One of the ColumnWidthMode enumeration that adjust the column width. The default value is None. |
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 DataGridColumns 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 DataGridTextColumn () {
MappingName = "Freight",
Format = "C",
CultureInfo = new CultureInfo("en-US")
});
DisplayBinding
Gets or sets the binding that associates the column with a property in the data source to display in cells.
Declaration
public BindingBase DisplayBinding { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.BindingBase |
Format
Gets or sets a value that indicates the format applied for the content of record cells in the column.
Declaration
public string Format { get; set; }
Property Value
Type |
---|
System.String |
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 |
---|
DataReflectionMode |
HeaderLineBreakMode
Gets or sets the LineBreak modes for the column header.
Declaration
public LineBreakMode HeaderLineBreakMode { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.Maui.LineBreakMode | It accepts LineBreakMode enum values. |
Remarks
This property allows you to breaking the text using line break mode options.
Examples
Here is an example of how to set the HeaderLineBreakMode property
<local:SfDataGrid>
<local:SfDataGrid.Columns>
<local:DataGridTextColumn HeaderLineBreakMode="WordWrap"/>
</local:SfDataGrid.Columns>
</local:SfDataGrid>
HeaderPadding
Gets or sets the inner padding of the column header.
Declaration
public Thickness HeaderPadding { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Thickness |
HeaderStyle
Gets or sets the style that is used to render the header cell in a column.
Declaration
public Style HeaderStyle { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.Style |
HeaderTemplate
Gets or sets the template used to display the header of the current column.
Declaration
public DataTemplate HeaderTemplate { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.DataTemplate |
Remarks
You can directly assign the Microsoft.Maui.Controls.DataTemplateSelector to choose the different Microsoft.Maui.Controls.DataTemplate based on header cells.
HeaderText
Gets or sets the text to be displayed in header.
Declaration
public string HeaderText { get; set; }
Property Value
Type |
---|
System.String |
HeaderTextAlignment
Gets or sets the alignment for the column header.
Declaration
public TextAlignment HeaderTextAlignment { get; set; }
Property Value
Type |
---|
Microsoft.Maui.TextAlignment |
LineBreakMode
Gets or sets LineBreakMode for the DataGridColumn. This is a bindable property.
Declaration
public LineBreakMode LineBreakMode { get; set; }
Property Value
Type |
---|
Microsoft.Maui.LineBreakMode |
LoadUIView
Gets or sets a value indicating whether to load the UI element into the DataGridCell or draw the cell value on Android, iOS and MAC.
Declaration
public bool LoadUIView { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the UI element is loaded in the grid cell; otherwise, false. The default value is true. |
Remarks
By default, the SfDataGrid loads the UI element in the grid cell. Set LoadUIView property to false to draw the cell values in the grid cell. This is applicable only for the Android, iOS and MAC platform. It always loads the UI element for the remaining platforms.
Examples
DataGridTextColumn column = new DataGridTextColumn();
column.LoadUIView = false;
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. |
MaximumWidth
Gets or sets the maximum width of a column.
Declaration
public double MaximumWidth { get; set; }
Property Value
Type |
---|
System.Double |
MinimumWidth
Gets or sets the minimum width of a column.
Declaration
public double MinimumWidth { get; set; }
Property Value
Type |
---|
System.Double |
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. |
UseBindingValue
Gets or sets a value that indicates whether the binding gets property value from column wrapper instead of reflecting value from the item properties.
Declaration
public bool UseBindingValue { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the property value gets from column wrapper; otherwise, false. The default value is false. |
Remarks
This property helps to perform , filtering, grouping operations on complex or indexer properties.
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 |
---|
Microsoft.Maui.Controls.BindingBase |
Visible
Gets or sets a value indicating whether a column should be visible.
Declaration
public bool Visible { get; set; }
Property Value
Type |
---|
System.Boolean |
Width
Gets or sets the width of a column.
Declaration
public double Width { get; set; }
Property Value
Type |
---|
System.Double |
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. |
SetConverterForDisplayBinding()
Sets the converter for the DisplayBinding of column.
Declaration
protected virtual void SetConverterForDisplayBinding()
Remarks
You can override this method to specify the converter for DisplayBinding.