Class DataGridAddNewRowController
Represents a controller class that manages the behavior and configuration of the AddNewRow feature in a SfDataGrid.
Inherited Members
Namespace: Syncfusion.Maui.DataGrid
Assembly: Syncfusion.Maui.DataGrid.dll
Syntax
public class DataGridAddNewRowController
Constructors
DataGridAddNewRowController(SfDataGrid)
Initializes a new instance of the DataGridAddNewRowController class. This constructor sets up the controller with the specified SfDataGrid instance.
Declaration
public DataGridAddNewRowController(SfDataGrid grid)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | grid | The SfDataGrid instance to be managed by this controller. |
Methods
AddNew(SfDataGrid)
Adds a new row to the DataGrid if allowed, propagating the Add New event and handling the new row assignment and selection.
Declaration
public virtual bool AddNew(SfDataGrid dataGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | The SfDataGrid instance in which to add a new row. |
Returns
| Type | Description |
|---|---|
| bool |
|
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown when an add operation is attempted while already in an add session. |
CancelAddNew()
Cancels the add new row operation in the associated DataGrid and resets the "Add New Row" state.
Declaration
public virtual void CancelAddNew()
CommitAddNew(SfDataGrid, bool)
Commits the add new row operation on the given SfDataGrid instance, and updates the Add New Row label visibility if the current cell is on the add new row.
Declaration
[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = "The EndEdit method is not trim compatible")]
public virtual void CommitAddNew(SfDataGrid dataGrid, bool changeState = true)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid | The DataGrid on which to commit the add new row. |
| bool | changeState | Whether to change row state; defaults to true. |
GetAddNewRowIndex(SfDataGrid)
Retrieves the index of the AddNewRow in the specified SfDataGrid.
Declaration
public int GetAddNewRowIndex(SfDataGrid dataGrid)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDataGrid | dataGrid |
Returns
| Type | Description |
|---|---|
| int | The index of the AddNewRow if available; otherwise -1. |