0

I'm migrating a project from android native to .net maui, by replacing native forms with embedded maui views (following the embedding method described in this MSDN page)

However, now I'm facing a tricky issue: there is an android native control, which draws some elements on a canvas and I would like to migrate it in .net maui as well.

Now, I'm wondering if there is a way to do that, maybe converting the Android.Graphics.Canvas object in a Maui.Graphics.Canvas, or embedding directly the android control in maui.

    public class AndroidNativeControl
    {

    // option 1: converting this object in a Microsoft.Maui.Graphics.Canvas
    public Android.Graphics.Canvas Canvas { get; set; }        
    
    // option 2: show this object in a .net maui content view
    protected internal Android.Views.View View { get; protected set; }

    }

Here a representation of the visual tree I would like to obtain:

- Android Native page
     - Maui embedded view
          - Maui stuff (e.g. label)
          - Converted canvas / android view
          - Maui stuff (e.g. button)
2
  • Aren't you considering just recreating this control with all native features within Android namespace in MAUI instead of embedding? Commented May 6, 2025 at 20:06
  • Unfortunately, this is not possible, because there are some maui controls in the visual tree which I can't simply remove and recreating them in Android namespace would be a mess Commented May 7, 2025 at 7:57

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.