Home > Software design >  Entry ReturnType Done not closing keyboard
Entry ReturnType Done not closing keyboard

Time:12-06

When I use the ReturnType property and set the value to "Done" nothing happens on the keyboard. I'm expecting the keyboard to close when I press done on my keyboard and nothing happens.

The issue is on Android, but on ios it works.

<Entry ReturnType="Done" /> 

CodePudding user response:

You can refer to Customize the return key.

ReturnType, of type ReturnType, specifies the appearance of the return button.

I created a project and tried to achieve your need:

<Entry x:Name="MyEntry"
       ReturnType="Done"
       Completed="Entry_Completed"/>
private void Entry_Completed(object sender, EventArgs e)
    {
        MyEntry.Unfocus();
    }

The result is that entry lost focus as expected, but the keyboard did not disappear.

I searched relevant information about this and found it (Implement pending focus management logic in Handlers). You can follow it.

CodePudding user response:

It seems the Focusable logic is still not implemented yet on Maui. They have stated it will be available in upcoming Previews.

So the workaround for this issue is setting the property IsEnabled to false and immediately setting it to true on your handler:

entry.IsEnabled=false; // This removes the focus and close the keyboard
entry.IsEnabled=true; // This re-enabled the Entry for interaction
  • Related