Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] Style with NamedSize #10006

Open
acaliaro opened this issue Mar 18, 2020 · 9 comments
Open

[Bug] Style with NamedSize #10006

acaliaro opened this issue Mar 18, 2020 · 9 comments

Comments

@acaliaro
Copy link

Description

I have some Styles in my Stylex.xaml under Xamarin Forms project. When I use this style, I have this string in"output" VisualStudio tab:
[0:] SetValue: Can not convert Xamarin.Forms.OnIdiom`1[Xamarin.Forms.NamedSize] to type 'System.Double'

Steps to Reproduce

  1. Create a style with TargetType="Label" and

     <Setter Property="FontSize">
         <Setter.Value>
             <OnIdiom
                 x:TypeArguments="NamedSize"
                 Phone="Small"
                 Tablet="Medium" />
         </Setter.Value>
     </Setter> 
    

Expected Behavior

No message in "output" tab

Actual Behavior

Message in "output" tab

Basic Information

  • Version with issue: 4.4.0.991537
  • Last known good version: unknown
  • IDE: Microsoft Visual Studio Community 2019
    Versione 16.5.0
  • Platform Target Frameworks:
    • Android: 9.0
@acaliaro acaliaro added s/unverified New report that has yet to be verified t/bug 🐛 labels Mar 18, 2020
@pauldipietro pauldipietro added this to New in Triage Mar 18, 2020
@jfversluis
Copy link
Member

If you change NamedSize to x:String does that work? I think the converter should pick it up and do the conversion for you

@jfversluis jfversluis added a/fonts a/style a/Xaml </> s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. labels Mar 18, 2020
@jfversluis jfversluis moved this from New to Needs Info in Triage Mar 18, 2020
@acaliaro
Copy link
Author

[0:] SetValue: Can not convert Xamarin.Forms.OnIdiom`1[System.String] to type 'System.Double'

@samhouts samhouts moved this from Needs Info to New in Triage Mar 18, 2020
@jfversluis
Copy link
Member

Looks like something similar was reported in #4319 and fixed, although I only see reference to the markup extension.

Tried it with the markup extension and that works, so as a workaround you should be able to do this:

<Setter Property="FontSize" Value="{OnIdiom Phone=Small, Tablet=Medium}" />

Reproduction showing the issue on iOS and Android is attached

Repro10006.zip

@jfversluis jfversluis added e/3 🕒 3 and removed s/unverified New report that has yet to be verified labels Mar 19, 2020
@jfversluis jfversluis moved this from New to Ready For Work in Triage Mar 19, 2020
@samhouts samhouts moved this from Ready For Work to Needs Estimate in Triage Mar 20, 2020
@samhouts samhouts moved this from Needs Estimate to Ready For Work in Triage Mar 20, 2020
@samhouts samhouts moved this from Ready For Work to Needs Info in Triage Mar 20, 2020
@samhouts
Copy link
Member

@acaliaro Since we haven't heard from you in more than 30 days, we hope this issue is no longer affecting you. If it is, please reopen this issue and provide the requested information so that we can look into it further. Thank you!

Triage automation moved this from Needs Info to Closed Apr 20, 2020
@samhouts samhouts removed the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Apr 20, 2020
@samhouts samhouts reopened this Apr 20, 2020
Triage automation moved this from Closed to New Apr 20, 2020
@samhouts
Copy link
Member

Oops, wrong issue. Reopened :)

@samhouts samhouts moved this from New to Ready For Work in Triage Apr 20, 2020
@samhouts samhouts added this to To do in Other Ready For Work Apr 20, 2020
@samhouts samhouts removed this from Ready For Work in Triage Apr 20, 2020
@acaliaro
Copy link
Author

@samhouts I am waiting an answer... I have done a repo but not answers till now... what should I do?

@samhouts
Copy link
Member

@acaliaro We verified the bug, and now it's on the backlog. Was the workaround in #10006 (comment) helpful at all? Thanks!

@acaliaro
Copy link
Author

I will try the workaround
Thanks

@ronymesquita
Copy link
Contributor

ronymesquita commented May 29, 2020

Looks like something similar was reported in #4319 and fixed, although I only see reference to the markup extension.

Tried it with the markup extension and that works, so as a workaround you should be able to do this:

<Setter Property="FontSize" Value="{OnIdiom Phone=Small, Tablet=Medium}" />

Reproduction showing the issue on iOS and Android is attached

Repro10006.zip

This workaround also works on a similar manner with OnPlatform:
<Setter Property="FontSize" Value="{OnPlatform Android=Micro, iOS=Small}" />

The tag OnPlatform didn't work in the normal syntax, like this:

<OnPlatform x:TypeArguments="NamedSize">
    <On Platform="Android" Value="Micro" />
    <On Platform="iOS" Value="Small" />
</OnPlatform>

@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts added this to To do in vNext+1 (5.0.0) Aug 13, 2020
@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

No branches or pull requests

4 participants