Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System;
using SampleApp.Droid.Effects;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ResolutionGroupName("SuperAwesome")]
[assembly: ExportEffect(typeof(CatEffect), "CatEffect")]
namespace SampleApp.Droid.Effects
{
public class CatEffect : PlatformEffect
{
protected override void OnAttached()
{
try
{
if (Control is EntryEditText)
{
Control.SetBackgroundResource(Resource.Drawable.cat);
}
}
catch (Exception ex)
{
Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
}
}
protected override void OnDetached()
{
// Back to white.
Control.SetBackgroundColor(Android.Graphics.Color.White);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment