maui
maui copied to clipboard
FontImage markup extension doesn't allow AppThemeBinding
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
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:
- AppThemeBinding usage with BindableProperty (#15573), similarity score: 0.74
- ToolbarItem font icon color not updating with AppThemeBinding (#23201), similarity score: 0.71
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
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
as a workaround, using {FontImageSource} works. Once #23657 is merged, it also becomes the recommended way, as {fontImage will be deprecated}
@mgoertz-msft @DianaSoltani can we get a code analyzer fix for this and work it into Upgrade Assistant?
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. :)
Merged to net10 branch