Articles in this section
Category / Section

How to specify a keyboard for a particular column type in .NET MAUI DataGrid?

2 mins read

The .NET MAUI DataGrid allows customization of the keyboard type for specific column types to enhance data entry efficiency.

C#

We can customize the keyboard type of the column by specifying the renderer for the column. By overriding the OnCreateEditUIView() method, we can access the edit element of the column, allowing us to set the keyboard type for the entry in this method.

public class CustomTextBoxRenderer : DataGridTextBoxCellRenderer
{
    protected override SfDataGridEntry OnCreateEditUIView()
    {
        var entry = base.OnCreateEditUIView();
        entry.Keyboard = Keyboard.Numeric;
        return entry;
    }
}

Replace the old renderer with the newly customized version. please refer to Column types UG document to understand which key corresponds to each type of column.

public MainPage()
{
    InitializeComponent();
    dataGrid.CellRenderers.Remove("Text");
    dataGrid.CellRenderers.Add("Text", new CustomTextBoxRenderer());
}

The following screenshot illustrates that the keyboard type has been set to numeric for the text column type in the MAUI DataGrid.

SfDataGridSample_NumericKeyboard.png

Download the complete sample from GitHub

Conclusion
I hope you enjoyed learning how to specify a keyboard for a particular column type in .NET MAUI DataGrid.

You can refer to our .NET MAUI DataGrid feature tour page to learn about its other groundbreaking feature representations. Explore our .NET MAUI DataGrid Documentation to understand how to present and manipulate data.
For current customers, check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI DataGrid and other .NET MAUI components.
Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied