AathifMahir / MauiIcons

MauiIcons is Icon Collection Library for .Net Maui
MIT License
196 stars 13 forks source link

Cannot use AppThemeBinding for IconColor #88

Closed indyjason79 closed 5 months ago

indyjason79 commented 5 months ago

Describe the bug Trying to use AppThemeBinding for my IconColor like so:

<ImageSource="{icons:Material Icon=Add, IconSize=14, IconColor={AppThemeBinding Light={StaticResource White}, Dark={StaticResource PrimaryDarkText}}}" />

and get the following compile time exception:

Pages\ProductsPage.xaml(108,29): XamlC error XFC0009: No property, BindableProperty, or event found for "IconColor", or mismatching type between value and property.

To Reproduce Steps to reproduce the behavior:

  1. Try to use AppThemeBinding for IconColor

Expected behavior I expected to be able to set the color based on the theme like you can do everywhere else.

Screenshots N/A

Desktop and Smartphone (please complete the following information):

Additional context N/A

AathifMahir commented 5 months ago

@indyjason79 This issue seems to be related to Maui App Theme Binding Support https://github.com/dotnet/maui/issues/15573

Currently, You can use AppThemeBinding on MauiIcons Built in Control, that does support it or a Control that has Direct BindableProperty to Color like Label TextColor and etc..

<mi:MauiIcon Icon="{mi:Material Icon=AccessAlarms}" IconColor="{AppThemeBinding Dark={StaticResource Blue200Accent}, Light={StaticResource Blue100Accent}}" />

<Label Text="{mi:Material Icon=AccessAlarms}" TextColor="{AppThemeBinding Dark={StaticResource Blue200Accent}, Light={StaticResource Blue100Accent}}"/>
AathifMahir commented 5 months ago

@indyjason79 Little While Ago, I have rollout a new update for MauiIcons, that enables us to use ImageSource Like Below Code


<Image>
  <Image.Source>
    <FontImageSource Glyph="{mi:Material Icon=AccessAlarms}" Color="{AppThemeBinding Dark={StaticResource 
      Blue200Accent}, Light={StaticResource Blue100Accent}}"/>
  </Image.Source>
</Image>
indyjason79 commented 5 months ago

@indyjason79 Little While Ago, I have rollout a new update for MauiIcons, that enables us to use ImageSource Like Below Code

<Image>
  <Image.Source>
    <FontImageSource Glyph="{mi:Material Icon=AccessAlarms}" Color="{AppThemeBinding Dark={StaticResource 
      Blue200Accent}, Light={StaticResource Blue100Accent}}"/>
  </Image.Source>
</Image>

That's exactly what I was trying to do. Thanks for the quick reply, and love the library! :D

AathifMahir commented 5 months ago

@indyjason79 Little While Ago, I have rollout a new update for MauiIcons, that enables us to use ImageSource Like Below Code

<Image>
  <Image.Source>
    <FontImageSource Glyph="{mi:Material Icon=AccessAlarms}" Color="{AppThemeBinding Dark={StaticResource 
      Blue200Accent}, Light={StaticResource Blue100Accent}}"/>
  </Image.Source>
</Image>

That's exactly what I was trying to do. Thanks for the quick reply, and love the library! :D

Really glad that I can sort this issue out 👍