As I always say, the more control we have over how elements behave in our apps, the better experience we can provide to users.
In this article, weβll explore an interesting feature of the virtual keyboard: how to show or hide it strategically to improve usability. With .NET MAUI, you can achieve this easily in just a few steps. Letβs dive in! π
Let’s get started! π
The first thing you should know when you hear or read about the term “soft input keyboard” is that it refers to the virtual keyboard that appears on the screen when entering text.
What are SoftInputExtensions?
In .NET MAUI, several UI elements, such as Entry and Editor, accept text input and automatically interact with the soft input keyboard. With SoftInputExtensions, we can take full control of its visibility using extension methods, allowing us to easily show or hide the keyboard as needed.
SoftInputExtensions Methods
The SoftInputExtensions class provides the following methods:
πΉ HideSoftInputAsync β Hides the soft input keyboard if it is currently visible.
πΉ ShowSoftInputAsync β Displays the soft input keyboard if it is currently hidden.
πΉ IsSoftInputShowing β Returns a boolean value indicating whether the soft input keyboard is currently displayed on the screen. – βοΈ I recommend using this method before deciding whether to show or hide the soft input keyboard.
How to implement it
Spanish article
References
This article was based on the official documentation.