
In this article, I'm going to show you how to add a DONE button to the keyboard in .NET MAUI by using a custom handler foriOS compatible with iOS 15+.
Create a static class EntryHandler
usingMicrosoft.Maui;usingSystem.Drawing;#if IOSusingUIKit;usingFoundation;#endifnamespaceDemoMauiApp.Handlers;publicclassEntryHandler{publicstaticvoidAddDone(){Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("Done",(handler,view)=>{#if IOSvartoolbar=newUIToolbar(newRectangleF(0.0f,0.0f,50.0f,44.0f));toolbar.BackgroundColor=UIColor.LightGray;// Set the color you prefervardoneButton=newUIBarButtonItem(UIBarButtonSystemItem.Done,delegate{handler.PlatformView.ResignFirstResponder();});toolbar.Items=newUIBarButtonItem[]{newUIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),doneButton};handler.PlatformView.InputAccessoryView=toolbar;#endif});}}
Register the handler
On theMauiProgram.cs file register the handlerEntryHandler.AddDone();
Conclusion
This is a port from our friendyuv4ik atgithub(thanks for sharing it) with a few modifications to add the DONE button to all types of keyboards in .NET MAUI using handlers.
Thanks for reading! Follow me on Twitter@ivictorhugo
Top comments(2)

Completed event in the entry can be triggered with following slight modification incase logic is dependent on Completed event:
var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate
{
handler.PlatformView.ResignFirstResponder();
handler.VirtualView?.Completed(); // <--- Triggers completed event
});
For further actions, you may consider blocking this person and/orreporting abuse