Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ButtonContent does not display icon #31

Open
tfierens opened this issue Nov 2, 2023 · 1 comment
Open

ButtonContent does not display icon #31

tfierens opened this issue Nov 2, 2023 · 1 comment

Comments

@tfierens
Copy link

tfierens commented Nov 2, 2023

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

@RadekVyM
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants