maui icon indicating copy to clipboard operation
maui copied to clipboard

FontImage markup extension doesn't allow AppThemeBinding

Open davidortinau opened this issue 1 year ago • 1 comments

Description

This works in Hot Reload, but won't compile.

<Button Text="Comment" 
                            Background="Transparent" 
                            TextColor="{AppThemeBinding Light=Black, Dark=White}" 
                            ImageSource="{FontImage Glyph={x:Static f:FontAwesome.CommentAlt}, Color={AppThemeBinding Light=Black, Dark=White}, FontFamily=FontAwesome, Size=18}" />

This works everywhere:

<Button Text="Comment" 
                            Background="Transparent" 
                            TextColor="{AppThemeBinding Light=Black, Dark=White}" >
                            <Button.ImageSource>
                                <FontImageSource Glyph="{x:Static f:FontAwesome.CommentAlt}" 
                                    Color="{AppThemeBinding Light=Black, Dark=White}" 
                                    FontFamily="FontAwesome" 
                                    Size="18" />
                            </Button.ImageSource>
                        </Button>

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.61 SR6.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

davidortinau avatar Jun 28 '24 18:06 davidortinau

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

github-actions[bot] avatar Jun 28 '24 18:06 github-actions[bot]

I think this was discussed in the past already, but it looks like the FontImageExtension could be removed, and you could use the FontImageSource element with a markup syntax

StephaneDelcroix avatar Jul 15 '24 15:07 StephaneDelcroix

as a workaround, using {FontImageSource} works. Once #23657 is merged, it also becomes the recommended way, as {fontImage will be deprecated}

StephaneDelcroix avatar Jul 17 '24 16:07 StephaneDelcroix

@mgoertz-msft @DianaSoltani can we get a code analyzer fix for this and work it into Upgrade Assistant?

davidortinau avatar Aug 12 '24 16:08 davidortinau

I would start by marking [Obsolete(...)] with a message of what to use instead. All these one-off analyzers/codefixers aren't cheap since we do not have a good infrastructure for manipulating XAML. We can add that to the score card. :)

mgoertz-msft avatar Aug 12 '24 22:08 mgoertz-msft

Merged to net10 branch

jfversluis avatar Feb 10 '25 16:02 jfversluis