1 year ago

#335604

test-img

moon

How to persist an Avalonia Geometry object?

I'm getting an error trying to serialize an Avalonia.Media.Geometry object with Json.Net.

RectangleGeometry geometry = new RectangleGeometry(new Rect(32, 32, 32, 32));
string json = JsonConvert.SerializeObject(geometry);

gives
Self referencing loop detected for property 'Standardized' with type 'SkiaSharp.SKRect'. Path 'PlatformImpl.EffectivePath.Bounds'.

In WPF one can use string x = XamlWriter.Save(geometry);, but in Avalonia I can only find AvaloniaXamlLoader.

Does Avalonia have a WPF XamlWriter equivilent? Or perhaps some other method to persist a Geometry?

avaloniaui

avalonia

0 Answers

Your Answer

Accepted video resources