Hello,
The link you mentioned is old, you can refer to the latest doc - .NET MAUI control customization with handlers - .NET MAUI | Microsoft Learn
ModifyMapping can modify an existing mapping, it looks like NoUnderline didn't exist. And this ModifyMapping method has three arguments for the second parameter, you set only two objects, see PropertyMapperExtensions.ModifyMapping<TVirtualView,TViewHandler> Method
method
Action<TViewHandler,TVirtualView,Action<IElementHandler,IElement>>
The modified method to call when the property is updated.
You can refer to the following code and using Microsoft.Maui.Platform; as you said:
#if ANDROID
Microsoft.Maui.Handlers.EntryHandler.Mapper.ModifyMapping("NoUnderline", (h, v, e) =>
{
h.PlatformView.BackgroundTintList = ColorStateList.ValueOf(Colors.Transparent.ToPlatform());
});
#endif
but my background color set in xaml is changed to white
You could try to customize a drawable under Platform/Android/Resources and set h.PlatformView.Background.
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.