DEV Community

David Ortinau for .NET

Posted on

1

Tinting Icons and Images in Xamarin.Forms

Sometimes you need to change the color of an icon, but you don't want to go through the ceremony of rebuilding the FontImageSource. Who does?! The Xamarin Community Toolkit recently added a very convenient tint effect just for this purpose.

<ImageButton
Source="{FontImage
FontFamily={StaticResource FontAwesome},
Glyph={x:Static local:IconFont.PaperPlane},
Color=White,
Size=64}"
HorizontalOptions="Center"
BackgroundColor="Transparent"
Margin="0,0,0,100"
xct:IconTintColorEffect.TintColor="{AppThemeBinding Light=White, Dark=#333333}"
Clicked="ImageButton_Clicked" />
view raw Snippet.xaml hosted with ❤ by GitHub

Resoures:

GitHub logo davidortinau / FlyMe

Xamarin.Forms demo for 3 sessions presented at Microsoft Ignite 2019

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay