[FIXED] MAUI project and Microsoft.Maui.Controls.Resource

Issue

I am trying to port Xamarin code to MAUI, and do not understand how to fix this issue:

In Xamarin project, there are calls:

Resource.Id.background_image
Resource.Id.caption
Resource.Styleable.SignaturePadView

etc etc etc

I have copied resources from the Xamarin project.

Resources-Xamarin-MAUI

And Xamarin project does not have other resources to transfer to MAUI project.

And In Xamarin project I can’t inspect particular resources, names are displayed in grayed color and I can’t ctrl+click to view them.

Xamarin-Resource-References

What I don’t understand, how to deal with resource visibility issues:

Resources-Are-Not-Visible

Where are resources, related to Microsoft.Maui.Controls.Resource namespace should be located in my case, and why they are not visible for my code?

=====
UPDATE

I have tried to set "Embedded resource" and "Resource" in properties of files in the Resources folder, but without success.

====
UPDATE #2

I decided to use DrawingView from Maui.CommunityToolkit to create the same functionality. It will take less time than porting Xamarin.SignaturePad to MAUI.

Documentation: https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/views/drawingview

How to use DrawingView: https://www.youtube.com/watch?v=7rw13_a5GR0

Solution

If you need to migrate your project, you need to update any incompatible NuGet packages. Xamarin.Controls.SignaturePad is not compatible in MAUI, you need to update this NuGet package. You can check this doc for changes in properties of files after Android migration.

Answered By – Dongzhi Wang-MSFT

Answer Checked By – Marilyn (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published