I'm developing an app using Xamarin.iOS and Mapbox iOS SDK (Naxam.Mapbox.iOS NuGet package here. And i'm following this example in MapBox iOS SDK website: https://docs.mapbox.com/ios/maps/examples/clustering/.
And i'm having problems converting this part of code to C#:
// Color clustered features based on clustered point counts.
let stops = [
20: UIColor.lightGray,
50: UIColor.orange,
100: UIColor.red,
200: UIColor.purple
]
And:
circlesLayer.circleColor = NSExpression(format: "mgl_step:from:stops:(point_count, %@, %@)", UIColor.lightGray, stops)
I'm able to set an unique color to the cluster if i do it like this:
circlesLayer.CircleColor = NSExpression.FromConstant(FromObject(UIColor.Green));
But i'm not managing to do it if i follow the example, in it, the Expression format takes 3 Parameters: string, UiColor, Array
But in C# NSExpression.FromConstant
, takes at max 2 params: string and a NSObject[], so i created this: (to match the array "stops" in the examle)
NSDictionary[] stops = new NSDictionary[]
{
new NSDictionary(new NSNumber(0), FromObject(UIColor.Green)),
new NSDictionary(new NSNumber(20), FromObject(UIColor.Blue)),
new NSDictionary(new NSNumber(100), FromObject(UIColor.Red))
};
But it no success, what should i be doing instead?