Articles in this section
Category / Section

How to show the number keyboard while editing GridNumericColumn in WPF DataGrid (SfDataGrid)?

1 min read

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());
}

 

Show the number keyboard for numeric column in WPF DataGrid

View sample in GitHub.

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