SimpleToolkit icon indicating copy to clipboard operation
SimpleToolkit copied to clipboard

ButtonContent does not display icon

Open tfierens opened this issue 1 year ago • 1 comments

Downloaded latest version of SimpleToolkit.Core (3.0.0) from Nuget.

Added the UseSimpleToolkit to builder as suggested in documentation

var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() .RegisterAppServices() .UseSimpleToolkit() .RegisterViewModels() .RegisterViews() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); }); Added the namespace to my page:

xmlns:simpleCore="clr-namespace:SimpleToolkit.Core;assembly=SimpleToolkit.Core"

I didn't see any mention in the documentation as to what the namespace should be so making an assumption that this is the correct one since I was able to access the ButtonContent from it.

And this is the xaml code for the ContentButton:

<simpleCore:ContentButton> <HorizontalStackLayout Padding="12,10" Spacing="10"> <simpleCore:Icon Source="email32.png" TintColor="Red" VerticalOptions="Center" HeightRequest="18" WidthRequest="18"/> <Label Text="Sign in with email" TextColor="White" FontAttributes="Bold" VerticalOptions="Center"/> </HorizontalStackLayout> </simpleCore:ContentButton> It displays the text ok but not the icon. When I changed the simpleCore:icon TintColor property to red that I spotted a little red square but no image.

I'm testing this with an Android project where my icons (.png) are stored under Platforms\Android\Resources\drawable folder. Note that my icon gets displayed when I use:

<Image Source="email32.png" WidthRequest="30" HeightRequest="30" Margin="10"/>

which would indicate that the icon is available to the project.

Any ideas how to resolve this?

Thanks

tfierens avatar Nov 02 '23 10:11 tfierens

Hi @tfierens,

could you please try the newest version of SimpleToolkit? I tried your code and it worked for me. If it does not work, you can always use IconTintColorBehavior from Community Toolkit.

RadekVyM avatar Nov 17 '23 08:11 RadekVyM