Hiding the virtual keyboard for a SfNumericEntry control

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:

Image_3815_1706237622065

But when I click on the button, the keyboard remains:

Image_9059_1706237889709

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!


3 Replies

AK Arunachalam Kandasamy Raja Syncfusion Team January 26, 2024 01:30 PM UTC

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


Attachment: NumericEntrySample186431_f73500bb.zip


AL Alfredo January 28, 2024 02:31 PM UTC

That worked, although the call to hide the virtual keyboard in .NET Maui is HidekeyboardAsync, not HideSoftInputAsync.  

Thank you Arunachalam!

Alfredo



PR Preethi Rajakandham Syncfusion Team January 29, 2024 06:30 AM UTC

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


Loader.
Up arrow icon