Category / Section
How to begin editing a cell on initial loading in .NET MAUI DataGrid?
2 mins read
This article demonstrates how to begin editing a cell on initial loading in .NET MAUI DataGrid(SfDataGrid).
To begin editing a specific cell when the .NET MAUI SfDataGrid is initially loaded, you can use the DataGridLoaded event. This event is triggered once the DataGrid and its components are fully initialized and rendered. By invoking the BeginEdit method within this event, you can programmatically start editing a particular cell.
Xaml
<ContentPage.Content>
<syncfusion:SfDataGrid
x:Name="dataGrid"
AllowEditing="True"
SelectionUnit="Cell"
SelectionMode="Single"
ItemsSource="{Binding OrderInfoCollection}">
</syncfusion:SfDataGrid>
</ContentPage.Content>
Xaml.cs
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
this.dataGrid.DataGridLoaded += DataGrid_DataGridLoaded;
}
private void DataGrid_DataGridLoaded(object? sender, EventArgs e)
{
this.dataGrid.BeginEdit(1, 0);
}
}
You can download this example on GitHub.