Closed tdbe closed 3 years ago
@tdbe Try skipping CDATA part and just use gradient:
cssGradientSource.Stylesheet = "linear-gradient(...)";
EDIT: To make life easier, we will add with next release something like:
gradientView.GradientSource = CssGradientSource.Parse("linear-gradient(...)");
Most of the time GradientView
is created in XAML or styled with CSS so we focus on this API, but if you think C# API is lacking some other features, please let us know :)
That worked! Thanks. I had no idea. The main reason to use C# is if you need to generate some ui components at runtime, say from a json that comes from the internet or from user interaction, and if you want those ui elemetns to have magic gradients.
There is no example of this on the internet.
Tried:
doesn't work.
.Stylesheet
is a string, but if you give it a string it throws an error saying it can't convert from"<![CDATA[linear-gradient....
into Xamarin.Forms.Color. And I can't give it a StyleSheet either. So how do?My app absolutely needs to spawn some components that have gradient backgrounds, and the number of components or their properties depends on user input. So pls don't tell me to just use xaml not c# :)