From 10c92fe4a8a344553c9bcb239ffa3ffaf2a6c629 Mon Sep 17 00:00:00 2001 From: zhangxi <526684540@qq.com> Date: Thu, 24 Aug 2023 14:24:15 +0800 Subject: [PATCH] fix polygon/polyline load fail points within the template --- src/Avalonia.Controls/Shapes/Polygon.cs | 7 +------ src/Avalonia.Controls/Shapes/Polyline.cs | 9 ++------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Avalonia.Controls/Shapes/Polygon.cs b/src/Avalonia.Controls/Shapes/Polygon.cs index 78def84448..2d56ced31d 100644 --- a/src/Avalonia.Controls/Shapes/Polygon.cs +++ b/src/Avalonia.Controls/Shapes/Polygon.cs @@ -6,18 +6,13 @@ namespace Avalonia.Controls.Shapes public class Polygon : Shape { public static readonly StyledProperty> PointsProperty = - AvaloniaProperty.Register>("Points"); + AvaloniaProperty.Register>("Points", new Points()); static Polygon() { AffectsGeometry(PointsProperty); } - public Polygon() - { - Points = new Points(); - } - public IList Points { get => GetValue(PointsProperty); diff --git a/src/Avalonia.Controls/Shapes/Polyline.cs b/src/Avalonia.Controls/Shapes/Polyline.cs index 2533794f89..63c37780c5 100644 --- a/src/Avalonia.Controls/Shapes/Polyline.cs +++ b/src/Avalonia.Controls/Shapes/Polyline.cs @@ -3,10 +3,10 @@ using Avalonia.Media; namespace Avalonia.Controls.Shapes { - public class Polyline: Shape + public class Polyline : Shape { public static readonly StyledProperty> PointsProperty = - AvaloniaProperty.Register>("Points"); + AvaloniaProperty.Register>("Points", new Points()); static Polyline() { @@ -14,11 +14,6 @@ namespace Avalonia.Controls.Shapes AffectsGeometry(PointsProperty); } - public Polyline() - { - Points = new Points(); - } - public IList Points { get => GetValue(PointsProperty);