Class DataGridPercentColumn
Represents a column type that displays and edits percentage values in SfDataGrid.
Inherited Members
Namespace: Syncfusion.Maui.DataGrid
Assembly: Syncfusion.Maui.DataGrid.dll
Syntax
public class DataGridPercentColumn : DataGridColumn, IDisposable, IFilterDefinition
Remarks
The DataGridPercentColumn is designed for displaying decimal values as percentages. The underlying data is stored as a numeric value (typically in the range 0-1, e.g., 0.25), and the column formats it for display/editing based on the PercentEditMode.
Display Modes:
| Mode | Behavior |
|---|---|
| PercentMode | Multiplies value by 100 (0.25 displays as "25%") |
| DoubleMode | Displays value as-is (0.25 displays as "0.25%") |
The column inherits from DataGridColumn and supports all standard column features including: sorting, filtering, grouping, cell templates, data validation, and serialization.
// Create a percentage column with PercentMode (default)
var percentColumn = new DataGridPercentColumn
{
MappingName = "Discount",
HeaderText = "Discount %",
PercentSymbol = "%",
PercentEditMode = PercentEditMode.PercentMode
};
dataGrid.Columns.Add(percentColumn);
Constructors
DataGridPercentColumn()
Initializes a new instance of the DataGridPercentColumn class.
Declaration
public DataGridPercentColumn()
Remarks
Initializes the column with default settings: right-aligned text, culture-aware formatting, and PercentMode display.
Fields
AllowNullValueProperty
Bindable property of AllowNullValue.
Declaration
public static readonly BindableProperty AllowNullValueProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
NullValueProperty
Bindable property for NullValue
Declaration
public static readonly BindableProperty NullValueProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
PercentEditModeProperty
Identifies the PercentEditMode bindable property.
Declaration
public static readonly BindableProperty PercentEditModeProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
Remarks
This bindable property determines how percentage values are formatted for display and parsing during editing.
PercentSymbolProperty
Identifies the PercentSymbol bindable property.
Declaration
public static readonly BindableProperty PercentSymbolProperty
Field Value
| Type |
|---|
| Microsoft.Maui.Controls.BindableProperty |
Remarks
This bindable property defines the symbol appended to percentage values during display and editing.
Properties
AllowNullValue
Gets or sets a System.Boolean value indicating whether to commit null values to the DataGridNumericColumn. This is a bindable property.
Declaration
public bool AllowNullValue { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
NullValue
Gets or sets an object that is displayed instead of null value if the cell value is null, provided that AllowNullValue is enabled.
Declaration
public object NullValue { get; set; }
Property Value
| Type |
|---|
| System.Object |
PercentEditMode
Gets or sets the display and editing mode for percentage values.
Declaration
public DataGridPercentEditMode PercentEditMode { get; set; }
Property Value
| Type | Description |
|---|---|
| DataGridPercentEditMode | One of the PercentEditMode enumeration values. The default value is PercentMode. |
Remarks
PercentMode (Default): The underlying numeric value is multiplied by 100 for display/edit. Example: 0.25 (stored) → "25%" (displayed).
DoubleMode: The underlying numeric value is displayed as-is with the percentage symbol. Example: 0.25 (stored) → "0.25%" (displayed).
PercentSymbol
Gets or sets the percentage symbol appended to values during display and editing.
Declaration
public string PercentSymbol { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The percentage symbol string. The default value is "%". |
Remarks
This property allows customization of the symbol used to indicate percentage values. If set to null, it defaults to "%". Common alternatives include "%%", "‰", etc.
Methods
SetConverterForDisplayBinding()
Sets the converter for the DisplayBinding of the percentage column.
Declaration
protected override void SetConverterForDisplayBinding()
Overrides
Remarks
This method overrides the base implementation to use Syncfusion.Maui.DataGrid.PercentColumnValueConverter which properly handles percentage formatting based on PercentEditMode.