Handling Keyboard Overlap EditCell in RadDataGrid for .NET MAUI
Environment
| Version | Product | Author |
|---|---|---|
| 15.1.0 | Telerik UI for .NET MAUI DataGrid | Dobrinka Yordanova |
Description
When using DataGrid for .NET MAUI within a ScrollView on iOS, the on-screen keyboard may overlap the cell being edited when the grid is positioned bottom of the page. This can make it difficult to see and interact with the input field.
This knowledge base article also answers the following questions:
- How to prevent the iOS keyboard from hiding input controls in UI for .NET MAUI?
- How to configure the keyboard behavior with DataGrid in a ScrollView?
- How to ensure the edited cell remains visible when the keyboard appears and DataGrid is inside ScrollView?
Solution
To prevent the keyboard from overlapping the editable cell in DataGrid when the control is inside ScrollView, configure the grid and its cell editor using the KeyboardHelper class and CellEditorStyle. Follow these steps:
-
Add the
telerik:KeyboardHelper.IsTranslationPivot="True"property to the editor defined in theCellEditorStyle. -
Set the property
telerik:KeyboardHelper.IsTranslationTarget="True"on theRadDataGrid.
<ScrollView>
<telerik:RadDataGrid x:Name="dataGrid"
ItemsSource="{Binding DataItems}"
AutoGenerateColumns="False"
UserEditMode="Cell"
WidthRequest="300"
HeightRequest="400"
telerik:KeyboardHelper.IsTranslationTarget="True">
<telerik:RadDataGrid.Columns>
<telerik:DataGridTextColumn PropertyName="Name">
<telerik:DataGridTextColumn.CellEditorStyle>
<Style TargetType="telerik:RadEntry">
<Setter Property="telerik:KeyboardHelper.IsTranslationPivot" Value="True" />
</Style>
</telerik:DataGridTextColumn.CellEditorStyle>
</telerik:DataGridTextColumn>
</telerik:RadDataGrid.Columns>
</telerik:RadDataGrid>
</ScrollView>
This setup ensures that the keyboard translation mechanism uses the editor as the pivot element and adjusts the grid's position accordingly.
Note
If nesting the RadDataGrid inside a ScrollView is required, provide a definitive width and height for the grid to maintain proper UI virtualization and performance.