I'm just migrating an app from Xamarin to .Net MAUI. I have no problem displaying "images" anywhere I like at a specific requested size etc. However, I would like to display the default AppIcon at various specific locations in my app - eg custom title bar, custom menu bar etc, but I can't work out how to do it; every time I reference it I just get a blank space, albeit at the requested height.
The instructions say
".NET MAUI converts SVG files to Portable Network Graphic (PNG) files. Therefore, when adding an SVG file to your .NET MAUI app project, it should be referenced from XAML or C# with a .png extension. The only reference to the SVG file should be in your project file."
My appicon is made up of SVG background and foreground files and works fine as a standard appicon for Windows, ioS and Android where it shows up in the expected places. But surely I can use it at a place of my choosing? Or do I have to create my own version, in all the different sizes necessary for different playforms etc as in the bad old days of Xamarin?
Image Source="appicon.png"
- blank is displayed
Image source="some other image.png"
- works as expected
When you display an image its build action should be MauiImage whereas incase of AppIcon this is MauiIcon, so the behaviour is as expected
If you want this to work add another SVG that has both foreground and background together and then use that make sure build action is MauiIcon