Saturday, February 24, 2024

Rounded entry field using handlers in .NET Maui

Customizing the UI elements is challenging in app development when we are using cross platform mobile app development. UIs will be different in both the platforms but as a cross platform app developer they have to write a custom code to match the UI elements in both the platforms.

This customization was implemented using Custom Renders in Xamarin.Forms framework. Now in .NET Maui they are called as handlers. There are many ways to write handlers in Maui, for implementing rounded entry we use a  customized control approach. Handlers are global, to customize a specific Entry control on a page that contains multiple Entry controls, you should first subclass the Entry control.

You can then customize the EntryHandler, via its property mapper, to perform the desired modification only to CustomEntry instances:

If the handler customization is performed in your App class, any CustomEntry instances in the app will be customized as per the handler modification.
Consuming custom controls in XAML file:

Final outcome of this implementation is here:

Complete project can be found here: https://github.com/GovardhanNag/EditorRenderer.git


No comments:

Post a Comment

SSO login using Launcher in .NET MAUI

  Some of the scenarios require to open the external/system browser to perform oAuth 2.0 login and then receive the auth code via redirect U...