Category / Section
How to show the number keyboard while editing GridNumericColumn in WPF DataGrid (SfDataGrid)?
You can show the number keyboard for numeric columns by setting Input Scope property for SfNumericTextBox in WPF DataGrid (SfDataGrid). InputScope property provides a type of text input expected by that control.
You can achieve this by deriving a new class from GridCellNumericRenderer and override the OnCreateEditUIElement method. By setting InputScopeNameValue as Number for SfNumericTextBox in OnCreateEditUIElement method, which shows NumericKeyboard when touch keyboard in Numeric Columns.
C#
public class GridCellNumericRendererExt : GridCellNumericRenderer
{
protected override Syncfusion.UI.Xaml.Controls.Input.SfNumericTextBox OnCreateEditUIElement()
{
var element = base.OnCreateEditUIElement();
InputScope scope = new InputScope();
InputScopeName name = new InputScopeName();
name.NameValue = InputScopeNameValue.Number;
scope.Names.Add(name);
element.InputScope = scope;
return element;
}
}
public MainPage()
{
this.InitializeComponent();
this.grid.CellRenderers.Remove("Numeric");
this.grid.CellRenderers.Add("Numeric", new GridCellNumericRendererExt());
}
