Platform specific image resource #21095
IXChinmayD
started this conversation in
Upgrading from Xamarin
Replies: 1 comment 1 reply
-
Put them in the Platforms folders mirroring where you locate them in Xamarin.Forms, or if you want to use Resources/Images you can use conditional syntax by TFM. See the Condition example below. <ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
<MauiImage Include="Resources\Images\iOS\**" Condition="$(TargetFramework.Contains('-ios'))" />
<MauiImage Include="Resources\Images\Android\**" Condition="$(TargetFramework.Contains('-android'))" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup> Documentationhttps://learn.microsoft.com/en-us/dotnet/maui/user-interface/images/images?view=net-maui-8.0 Screenshots |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am migrating from Xamarin Forms to .NET8 MAUI. There are different resource folders based on the platform for Xamarin Forms. But, we have different images with identical names and types for different platforms. How to achieve the same in .NET MAUI.
Beta Was this translation helpful? Give feedback.
All reactions