1

I am using Xamarin.Community Toolkit's ShadowEffect.Color and IconTintColorEffect.TintColor through XAML and it is working fine, but how can I achieve this through the C# Code Behind. I have searched on Google and Community Forums but could not find anything.

Here is my code in XAML:

<BoxView BackgroundColor="White" xct:ShadowEffect.Color="Black" />
<Image Source="{extensions:ImageResource MyProject.Images.sample.png" xct:IconTintColorEffect.TintColor="Blue" />

Everything is working fine in XAML, but I want to achieve this from C# code behind.

Junaid Pathan
  • 3,850
  • 1
  • 25
  • 47

1 Answers1

2
ShadowEffect.SetColor(boxView, Color.Black);

IconTintColorEffect.SetTintColor(image, Color.Blue);

Where boxView and image are instances either from your xaml by using x:Name or instantiated in code.

Cfun
  • 8,442
  • 4
  • 30
  • 62