Issue
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.
Solution
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.
Answered By - Cfun
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.