Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradient Button in Xamarin Forms

Gradient Button

How do I create this button with Gradient Effect in Xamarin Forms using Renderer ?

like image 569
MainakChoudhury Avatar asked Dec 06 '22 12:12

MainakChoudhury


1 Answers

Now it is possible with Xamarin forms 4.8 with new features like gradient brushes and drag and drop features.

Check out this link => https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/brushes/

You can add a gradient background for any element such as button, frame, boxview etc..

Example code for Button:

<Button Text="Submit Order" CornerRadius="5" TextColor="White">
    <Button.Background>
        <LinearGradientBrush EndPoint="1,0">
            <GradientStop Color="Yellow" Offset="0.1" />
            <GradientStop Color="Green" Offset="1.0" />
        </LinearGradientBrush>
    </Button.Background>
</Button>

The output:

enter image description here

like image 101
Thameem Avatar answered Dec 26 '22 00:12

Thameem