Skip to content

MauiIcon ForegroundScale does not work on development machines that use a comma as a decimal seperator #11685

@AndreKraemer

Description

@AndreKraemer

Description

According to the docs at https://learn.microsoft.com/en-us/dotnet/maui/user-interface/images/app-icons?view=net-maui-7.0&tabs=android you can use the ForegroundScale Attribute of the MauiIcon element so scale your foreground layer like this:
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65" Color="#512BD4" />

This works fine if the decimal separator is a dot on your operating system's regional settings. If your operating system's regional settings use a comma as a decimal separator (like in most european countries), the image will, however not be scaled down if you use ForegroundScale="0.65", but instead, it will be scaled up.

Because of this, the foreground of the generated icon will never fit into the background.

Steps to Reproduce

  1. Create a File > New MAUI App on system that uses a comma as a decimal seperator
  2. Open the .csproj file and add ForegroundScale="0.65" to the MauiIcon element
  3. Run the app on Android or Windows
  4. You can't see the ".NET" text in the icon any more

Link to public reproduction project repository

https://github.com/AndreKraemer/MauiIconScalingIssue

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 13, Windows 10, Windows 11

Did you find any workaround?

You can use a comma as separator for the ForegroundScale attribute like this ForegroundScale="0,65". This will work if your dev system uses a comma as a decimal separator, but will break on systems that use a dot as a separator)

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions