Browse Source

fix polygon/polyline load fail points within the template:

Optimization fixed code
pull/12651/head
zhangxi 3 years ago
parent
commit
039b19f585
  1. 8
      src/Avalonia.Controls/Shapes/Polygon.cs
  2. 6
      src/Avalonia.Controls/Shapes/Polyline.cs

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

@ -1,18 +1,24 @@
using System.Collections.Generic;
using Avalonia.Media;
using Avalonia.Data;
namespace Avalonia.Controls.Shapes
{
public class Polygon : Shape
{
public static readonly StyledProperty<IList<Point>> PointsProperty =
AvaloniaProperty.Register<Polygon, IList<Point>>("Points", new Points());
AvaloniaProperty.Register<Polygon, IList<Point>>("Points");
static Polygon()
{
AffectsGeometry<Polygon>(PointsProperty);
}
public Polygon()
{
SetValue(PointsProperty, new Points(), BindingPriority.Template);
}
public IList<Point> Points
{
get => GetValue(PointsProperty);

6
src/Avalonia.Controls/Shapes/Polyline.cs

@ -1,5 +1,6 @@
using System.Collections.Generic;
using Avalonia.Media;
using Avalonia.Data;
namespace Avalonia.Controls.Shapes
{
@ -14,6 +15,11 @@ namespace Avalonia.Controls.Shapes
AffectsGeometry<Polyline>(PointsProperty);
}
public Polyline()
{
SetValue(PointsProperty, new Points(), BindingPriority.Template);
}
public IList<Point> Points
{
get => GetValue(PointsProperty);

Loading…
Cancel
Save