Search code examples
buttonxamarin.formsshadow

How to remove the shadow of a button on Xamarin Forms


is it possible? I would like to remove the shadow of the buttons on Xamarin Forms.

Thanks


Solution

  • For delete shadow on button Android you just need create a renderer in project Droid and set BackroundColor with transparent or other color.

    For a project using PCL :

    [assembly: ExportRenderer(typeof(Button),typeof(FlatButtonRenderer))]
    namespace Project.Droid
        {
            public class FlatButtonRenderer : ButtonRenderer
            {
                protected override void OnDraw(Android.Graphics.Canvas canvas)
                {
                    base.OnDraw(canvas);
                }
            }
        }
    

    In XAML :

    <Button BackgroundColor="Transparent" Text="ClickMe"/>