Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Platform="Default" not working #22105

Open
twojnarowski opened this issue Apr 28, 2024 · 1 comment · May be fixed by #22148
Open

On Platform="Default" not working #22105

twojnarowski opened this issue Apr 28, 2024 · 1 comment · May be fixed by #22148
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/android 🤖 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@twojnarowski
Copy link

Description

I want to have font sizes specific for each idiom and each platform. I have created a Resources file with this code:

    <OnIdiom x:Key="TestSizeDefault" x:TypeArguments="x:Double">
        <OnIdiom.Tablet>
            <OnPlatform x:TypeArguments="x:Double">
                <On Platform="iOS" Value="100" />
                <On Platform="Default" Value="100" />
            </OnPlatform>
        </OnIdiom.Tablet>
        <OnIdiom.Phone>
            <OnPlatform x:TypeArguments="x:Double">
                <On Platform="Default" Value="100" />
            </OnPlatform>
        </OnIdiom.Phone>
        <OnIdiom.Desktop>
            <OnPlatform x:TypeArguments="x:Double">
                <On Platform="Default" Value="100" />
            </OnPlatform>
        </OnIdiom.Desktop>
        <OnIdiom.Default>
            <OnPlatform x:TypeArguments="x:Double">
                <On Platform="Default" Value="100" />
            </OnPlatform>
        </OnIdiom.Default>
    </OnIdiom>

And while running the application on both Windows and Android phone, the font sizes are not being set to 100 from the "Default" platform. This is what it looks like in a reproduction repo (first text is from On Platform="Android" second one from On Platform="Default"):
image

Steps to Reproduce

Create an OnIdiom that has OnPlatform inside of it and make a Label use FontSize from the static resource with this OnIdiom.
Running the repository with reproduction, one Label gets big and other one does not, while both should have font size = 100.

Link to public reproduction project repository

https://github.com/twojnarowski/MauiAppOnPlatformDefaultRepro/tree/master

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows

Affected platform versions

No response

Did you find any workaround?

I have to set manually On Platforms for each platform, instead of using only Default where I want the same size for each platform.

Relevant log output

No response

@twojnarowski twojnarowski added the t/bug Something isn't working label Apr 28, 2024
@kevinxufei kevinxufei added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Apr 29, 2024
@kevinxufei
Copy link
Collaborator

kevinxufei commented Apr 29, 2024

Can repro this issue at android platform on the latest 17.10 Preview 5 (8.0.21&8.0.3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/android 🤖 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants