Delpin Susai Raj Sunday, 2 February 2020

Xamarin.Forms - Tint Image Color Using Effects

In this blog post, you will learn how to Change image color using Tint Color Effects in Xamarin.Forms.

Introduction

Xamarin.Forms code runs on multiple platforms - each of which has its own filesystem. This means that reading and writing files are most easily done using the native file APIs on each platform. Alternatively, embedded resources are a simpler solution to distribute data files with an app.

Tint Color

TintImage is used for change image color at runtime with the help of effects, you can achieve with custom render also. Tint images mainly used for reducing the usage of the images.

Prerequisites
  • Visual Studio 2017 or later (Windows or Mac)
Create TintImage

The Actual Image Color is Blue 

Now, Create a TintImage class inherit from RoutingEffect for Change image color.

TintImage.cs

Android Implementation

Here, Implement Platform Effects for TintImage at Runtime.

TintImageImpl.cs

iOS Implementation

Here, Implement Platform Effects for TintImage at Runtime.

TintImageImpl.cs

Consuming the TintImage

Now, Use the TintImage Effect in your XAML code.

MainPage.xaml

Click the "Play" button to try it out.

Wow, It's Working.😍

I hope you have understood how to Change image color using Tint Color Effects in Xamarin.Forms.

Thanks for reading. Please share your comments and feedback. Happy Coding 😀🙌

1 comment:

  1. Woah!! Such a piece of the nice information you have shared here, I have read the entire post and I must say that the information is very helpful for me.
    Hire Xamarin Developer
    Hire Xamarin Development Company
    Xamarin Development Company

    ReplyDelete