'ButtonHandler' does not contain a definition for 'ButtonMapper'

Viewed 31

enter image description here

Can anyone please tell me that why am I getting this error message?

1 Answers

Customize controls with handlers

#if ANDROID
Microsoft.Maui.Handlers.ButtonHandler.Mapper.AppendToMapping(nameof(IView.Background),
    (handler, view) =>
    {
        (handler.PlatformView as Android.Views.View).SetBackgroundColor(Microsoft.Maui.Graphics.Colors.Orange.ToNative());
    });
#endif

Edit

After I saw this issue I understood your confusion. There were some renaming done in order to ensure consistency, which causes breaking changes:

  • ButtonMapper --> Mapper
  • NativeView --> PlatformView
  • ToNative() --> ToPlatform()

Related GitHub issues:

Related