This is totally doable. I have two options for you:
- Use the RadSweepGradientBrush (easy, can be done in XAML)
- Use the SkiaSharp drawing libraries (harder, is done in C#, but more powerful)
Telerik Option - Path & SweepGradientBrush
Let me show you how to use our option. this is lightweight and easy to use. Just create a RadPath element/shape and use a RadSweepGradientBrush to fill it.
As an example of it in action, visit the RadPath Styling documentation. For your convenience, here's the code example from that article:
This is not a Xamarin.Forms.Color object that you can set on any plain Xamarin.Forms View element's BackgroundColor property. If you want to make a gradient background, you'll need to place a RadPath there so you can use the gradient brush inside it.
For example, let's say you wanted a gradient sweep on a Grid background, you'd place the RadPath at the bottom of the Grid's children:
<RadPath Fill="Your_Gradient" />
Microsoft Option - SkiaSharp
If this is not sufficient for your needs, you can use the Xamarin.Forms SkiaSharp library directly. This option is a bit more complicated because you're manually handing the surface and paint event, but it will achieve just about any custom drawing options you need.
Visit the following amazing Microsoft documentation article https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/effects/shaders/linear-gradient. (I think it was written by Charles Petzold).
I hope I was able to answer your question. If you have any trouble using the Path or SweepGradient, feel free to open a support ticket and get one-on-one help from the developers and support team.
Lance | Team Lead - US DevTools Support
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Feedback Portal
and vote to affect the priority of the items