From 94fd79f7d9c9bfaf144cdc472d20ad2641d4bfae Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 27 May 2023 21:02:09 -0400 Subject: [PATCH 1/3] Obsolete Border line dashes --- src/Avalonia.Controls/Border.cs | 54 +++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/Avalonia.Controls/Border.cs b/src/Avalonia.Controls/Border.cs index 78ba23c1dd..3c0802c013 100644 --- a/src/Avalonia.Controls/Border.cs +++ b/src/Avalonia.Controls/Border.cs @@ -50,24 +50,28 @@ namespace Avalonia.Controls /// /// Defines the property. /// + [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] public static readonly StyledProperty BorderDashOffsetProperty = AvaloniaProperty.Register(nameof(BorderDashOffset)); /// /// Defines the property. /// + [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] public static readonly StyledProperty?> BorderDashArrayProperty = AvaloniaProperty.Register?>(nameof(BorderDashArray)); /// /// Defines the property. /// + [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] public static readonly StyledProperty BorderLineCapProperty = AvaloniaProperty.Register(nameof(BorderLineCap), PenLineCap.Flat); /// /// Defines the property. /// + [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] public static readonly StyledProperty BorderLineJoinProperty = AvaloniaProperty.Register(nameof(BorderLineJoin), PenLineJoin.Miter); @@ -86,10 +90,6 @@ namespace Avalonia.Controls BorderBrushProperty, BorderThicknessProperty, CornerRadiusProperty, - BorderDashArrayProperty, - BorderLineCapProperty, - BorderLineJoinProperty, - BorderDashOffsetProperty, BoxShadowProperty); AffectsMeasure(BorderThicknessProperty); } @@ -115,8 +115,8 @@ namespace Avalonia.Controls /// public IBrush? Background { - get { return GetValue(BackgroundProperty); } - set { SetValue(BackgroundProperty, value); } + get => GetValue(BackgroundProperty); + set => SetValue(BackgroundProperty, value); } /// @@ -124,17 +124,18 @@ namespace Avalonia.Controls /// public IBrush? BorderBrush { - get { return GetValue(BorderBrushProperty); } - set { SetValue(BorderBrushProperty, value); } + get => GetValue(BorderBrushProperty); + set => SetValue(BorderBrushProperty, value); } /// /// Gets or sets a collection of values that indicate the pattern of dashes and gaps that is used to outline shapes. /// + [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] public AvaloniaList? BorderDashArray { - get { return GetValue(BorderDashArrayProperty); } - set { SetValue(BorderDashArrayProperty, value); } + get => GetValue(BorderDashArrayProperty); + set => SetValue(BorderDashArrayProperty, value); } /// @@ -142,35 +143,38 @@ namespace Avalonia.Controls /// public Thickness BorderThickness { - get { return GetValue(BorderThicknessProperty); } - set { SetValue(BorderThicknessProperty, value); } + get => GetValue(BorderThicknessProperty); + set => SetValue(BorderThicknessProperty, value); } /// /// Gets or sets a value that specifies the distance within the dash pattern where a dash begins. /// + [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] public double BorderDashOffset { - get { return GetValue(BorderDashOffsetProperty); } - set { SetValue(BorderDashOffsetProperty, value); } + get => GetValue(BorderDashOffsetProperty); + set => SetValue(BorderDashOffsetProperty, value); } /// /// Gets or sets a enumeration value that describes the shape at the ends of a line. /// + [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] public PenLineCap BorderLineCap { - get { return GetValue(BorderLineCapProperty); } - set { SetValue(BorderLineCapProperty, value); } + get => GetValue(BorderLineCapProperty); + set => SetValue(BorderLineCapProperty, value); } /// /// Gets or sets a enumeration value that specifies the type of join that is used at the vertices of a Shape. /// + [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] public PenLineJoin BorderLineJoin { - get { return GetValue(BorderLineJoinProperty); } - set { SetValue(BorderLineJoinProperty, value); } + get => GetValue(BorderLineJoinProperty); + set => SetValue(BorderLineJoinProperty, value); } /// @@ -178,8 +182,8 @@ namespace Avalonia.Controls /// public CornerRadius CornerRadius { - get { return GetValue(CornerRadiusProperty); } - set { SetValue(CornerRadiusProperty, value); } + get => GetValue(CornerRadiusProperty); + set => SetValue(CornerRadiusProperty, value); } /// @@ -227,8 +231,14 @@ namespace Avalonia.Controls /// The drawing context. public sealed override void Render(DrawingContext context) { - _borderRenderHelper.Render(context, Bounds.Size, LayoutThickness, CornerRadius, Background, BorderBrush, - BoxShadow, BorderDashOffset, BorderLineCap, BorderLineJoin, BorderDashArray); + _borderRenderHelper.Render( + context, + Bounds.Size, + LayoutThickness, + CornerRadius, + Background, + BorderBrush, + BoxShadow); } /// From a857c92a46df1ca52589a181bcace2e8cafc281c Mon Sep 17 00:00:00 2001 From: robloo Date: Sat, 27 May 2023 21:02:46 -0400 Subject: [PATCH 2/3] Update property get/set syntax in Shape --- src/Avalonia.Controls/Shapes/Shape.cs | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Avalonia.Controls/Shapes/Shape.cs b/src/Avalonia.Controls/Shapes/Shape.cs index 461dc1c947..a65ac774ef 100644 --- a/src/Avalonia.Controls/Shapes/Shape.cs +++ b/src/Avalonia.Controls/Shapes/Shape.cs @@ -126,8 +126,8 @@ namespace Avalonia.Controls.Shapes /// public IBrush? Fill { - get { return GetValue(FillProperty); } - set { SetValue(FillProperty, value); } + get => GetValue(FillProperty); + set => SetValue(FillProperty, value); } /// @@ -135,8 +135,8 @@ namespace Avalonia.Controls.Shapes /// public Stretch Stretch { - get { return GetValue(StretchProperty); } - set { SetValue(StretchProperty, value); } + get => GetValue(StretchProperty); + set => SetValue(StretchProperty, value); } /// @@ -144,8 +144,8 @@ namespace Avalonia.Controls.Shapes /// public IBrush? Stroke { - get { return GetValue(StrokeProperty); } - set { SetValue(StrokeProperty, value); } + get => GetValue(StrokeProperty); + set => SetValue(StrokeProperty, value); } /// @@ -153,8 +153,8 @@ namespace Avalonia.Controls.Shapes /// public AvaloniaList? StrokeDashArray { - get { return GetValue(StrokeDashArrayProperty); } - set { SetValue(StrokeDashArrayProperty, value); } + get => GetValue(StrokeDashArrayProperty); + set => SetValue(StrokeDashArrayProperty, value); } /// @@ -162,8 +162,8 @@ namespace Avalonia.Controls.Shapes /// public double StrokeDashOffset { - get { return GetValue(StrokeDashOffsetProperty); } - set { SetValue(StrokeDashOffsetProperty, value); } + get => GetValue(StrokeDashOffsetProperty); + set => SetValue(StrokeDashOffsetProperty, value); } /// @@ -171,8 +171,8 @@ namespace Avalonia.Controls.Shapes /// public double StrokeThickness { - get { return GetValue(StrokeThicknessProperty); } - set { SetValue(StrokeThicknessProperty, value); } + get => GetValue(StrokeThicknessProperty); + set => SetValue(StrokeThicknessProperty, value); } /// @@ -180,8 +180,8 @@ namespace Avalonia.Controls.Shapes /// public PenLineCap StrokeLineCap { - get { return GetValue(StrokeLineCapProperty); } - set { SetValue(StrokeLineCapProperty, value); } + get => GetValue(StrokeLineCapProperty); + set => SetValue(StrokeLineCapProperty, value); } /// @@ -189,8 +189,8 @@ namespace Avalonia.Controls.Shapes /// public PenLineJoin StrokeJoin { - get { return GetValue(StrokeJoinProperty); } - set { SetValue(StrokeJoinProperty, value); } + get => GetValue(StrokeJoinProperty); + set => SetValue(StrokeJoinProperty, value); } public sealed override void Render(DrawingContext context) From e18d9364b8286e5d72329d732fe8a09c8e979ad8 Mon Sep 17 00:00:00 2001 From: robloo Date: Sun, 28 May 2023 12:32:39 -0400 Subject: [PATCH 3/3] Completely remove Border line dash properties --- src/Avalonia.Controls/Border.cs | 68 --------------------------------- 1 file changed, 68 deletions(-) diff --git a/src/Avalonia.Controls/Border.cs b/src/Avalonia.Controls/Border.cs index 3c0802c013..e7373a813e 100644 --- a/src/Avalonia.Controls/Border.cs +++ b/src/Avalonia.Controls/Border.cs @@ -47,34 +47,6 @@ namespace Avalonia.Controls public static readonly StyledProperty BoxShadowProperty = AvaloniaProperty.Register(nameof(BoxShadow)); - /// - /// Defines the property. - /// - [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] - public static readonly StyledProperty BorderDashOffsetProperty = - AvaloniaProperty.Register(nameof(BorderDashOffset)); - - /// - /// Defines the property. - /// - [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] - public static readonly StyledProperty?> BorderDashArrayProperty = - AvaloniaProperty.Register?>(nameof(BorderDashArray)); - - /// - /// Defines the property. - /// - [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] - public static readonly StyledProperty BorderLineCapProperty = - AvaloniaProperty.Register(nameof(BorderLineCap), PenLineCap.Flat); - - /// - /// Defines the property. - /// - [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] - public static readonly StyledProperty BorderLineJoinProperty = - AvaloniaProperty.Register(nameof(BorderLineJoin), PenLineJoin.Miter); - private readonly BorderRenderHelper _borderRenderHelper = new BorderRenderHelper(); private Thickness? _layoutThickness; private double _scale; @@ -128,16 +100,6 @@ namespace Avalonia.Controls set => SetValue(BorderBrushProperty, value); } - /// - /// Gets or sets a collection of values that indicate the pattern of dashes and gaps that is used to outline shapes. - /// - [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] - public AvaloniaList? BorderDashArray - { - get => GetValue(BorderDashArrayProperty); - set => SetValue(BorderDashArrayProperty, value); - } - /// /// Gets or sets the thickness of the border. /// @@ -147,36 +109,6 @@ namespace Avalonia.Controls set => SetValue(BorderThicknessProperty, value); } - /// - /// Gets or sets a value that specifies the distance within the dash pattern where a dash begins. - /// - [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] - public double BorderDashOffset - { - get => GetValue(BorderDashOffsetProperty); - set => SetValue(BorderDashOffsetProperty, value); - } - - /// - /// Gets or sets a enumeration value that describes the shape at the ends of a line. - /// - [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] - public PenLineCap BorderLineCap - { - get => GetValue(BorderLineCapProperty); - set => SetValue(BorderLineCapProperty, value); - } - - /// - /// Gets or sets a enumeration value that specifies the type of join that is used at the vertices of a Shape. - /// - [Obsolete("Dashed lines on Border are no longer supported. Use Shapes directly instead.")] - public PenLineJoin BorderLineJoin - { - get => GetValue(BorderLineJoinProperty); - set => SetValue(BorderLineJoinProperty, value); - } - /// /// Gets or sets the radius of the border rounded corners. ///