Browse Source

fix polygon/polyline load fail points within the template

pull/12651/head
zhangxi 3 years ago
parent
commit
10c92fe4a8
  1. 7
      src/Avalonia.Controls/Shapes/Polygon.cs
  2. 9
      src/Avalonia.Controls/Shapes/Polyline.cs

7
src/Avalonia.Controls/Shapes/Polygon.cs

@ -6,18 +6,13 @@ namespace Avalonia.Controls.Shapes
public class Polygon : Shape
{
public static readonly StyledProperty<IList<Point>> PointsProperty =
AvaloniaProperty.Register<Polygon, IList<Point>>("Points");
AvaloniaProperty.Register<Polygon, IList<Point>>("Points", new Points());
static Polygon()
{
AffectsGeometry<Polygon>(PointsProperty);
}
public Polygon()
{
Points = new Points();
}
public IList<Point> Points
{
get => GetValue(PointsProperty);

9
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<IList<Point>> PointsProperty =
AvaloniaProperty.Register<Polyline, IList<Point>>("Points");
AvaloniaProperty.Register<Polyline, IList<Point>>("Points", new Points());
static Polyline()
{
@ -14,11 +14,6 @@ namespace Avalonia.Controls.Shapes
AffectsGeometry<Polyline>(PointsProperty);
}
public Polyline()
{
Points = new Points();
}
public IList<Point> Points
{
get => GetValue(PointsProperty);

Loading…
Cancel
Save