Hi,
I am writing an app that has a simple page that contains
a SfNumericEntry control and a button. In the Android emulator, when I click on the SfNumericEntry, the number keyboard appears and everything works fine. But when I hit the button, the numeric keyboard does not disappear.
This behavior also occurs for regular Entry and Editor Maui controls as well. You can see it if you create a default Maui app and add an Entry control at the bottom of the MainPage.xaml:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Tabular.Test.App.MainPage">
<ScrollView>
<VerticalStackLayout
Spacing="25"
Padding="30,0"
VerticalOptions="Center">
<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
HeightRequest="200"
HorizontalOptions="Center" />
<Label
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
<Label
Text="Welcome to .NET Multi-platform App UI"
SemanticProperties.HeadingLevel="Level2"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
FontSize="18"
HorizontalOptions="Center" />
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
HorizontalOptions="Center" />
<Entry x:Name="TestEntry"
HorizontalOptions="CenterAndExpand"
VerticalOptions="End"/>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
Clicking on the Entry control displays the virtual keyboard:
But when I click on the button, the keyboard remains:
For a regular Maui Entry control, I can intercept the Unfocused event and call the HideKeyboardAsync() method:
private void TestEntry_Unfocused(object sender, FocusEventArgs e)
{
((Entry)sender).HideKeyboardAsync(default);
}
However, the SfNumericEntry control does not contain such a method. Is there any way to hide the virtual SfNumericEntry keyboard programmatically?
Thanks for your assistance!
Hi Alfredo,
We have validated the reported query. We have created the sample to demonstrate how to programmatically hide the keyboard for the SfNumericEntry. Kindly obtain the sample from the attachment. If you have any further questions, please don't hesitate to ask.
Regards,
Arunachalam K
That worked, although the call to hide the virtual keyboard in .NET Maui is HidekeyboardAsync, not HideSoftInputAsync.
Thank you Arunachalam!
Alfredo
Hi Alfredo,
You're welcome.
We are glad that the provided response
meets your requirement. Please let us know if you need further assistance. As
always, we are happy to help you out.
Regards,
Preethi R