Browse Source

Merge pull request #11548 from robloo/remove-border-line-dash

Remove Line Dash from Border
pull/11559/head
Max Katz 3 years ago
committed by GitHub
parent
commit
532dedb1db
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 90
      src/Avalonia.Controls/Border.cs
  2. 32
      src/Avalonia.Controls/Shapes/Shape.cs

90
src/Avalonia.Controls/Border.cs

@ -47,30 +47,6 @@ namespace Avalonia.Controls
public static readonly StyledProperty<BoxShadows> BoxShadowProperty =
AvaloniaProperty.Register<Border, BoxShadows>(nameof(BoxShadow));
/// <summary>
/// Defines the <see cref="BorderDashOffset"/> property.
/// </summary>
public static readonly StyledProperty<double> BorderDashOffsetProperty =
AvaloniaProperty.Register<Border, double>(nameof(BorderDashOffset));
/// <summary>
/// Defines the <see cref="BorderDashArray"/> property.
/// </summary>
public static readonly StyledProperty<AvaloniaList<double>?> BorderDashArrayProperty =
AvaloniaProperty.Register<Border, AvaloniaList<double>?>(nameof(BorderDashArray));
/// <summary>
/// Defines the <see cref="BorderLineCap"/> property.
/// </summary>
public static readonly StyledProperty<PenLineCap> BorderLineCapProperty =
AvaloniaProperty.Register<Border, PenLineCap>(nameof(BorderLineCap), PenLineCap.Flat);
/// <summary>
/// Defines the <see cref="BorderLineJoin"/> property.
/// </summary>
public static readonly StyledProperty<PenLineJoin> BorderLineJoinProperty =
AvaloniaProperty.Register<Border, PenLineJoin>(nameof(BorderLineJoin), PenLineJoin.Miter);
private readonly BorderRenderHelper _borderRenderHelper = new BorderRenderHelper();
private Thickness? _layoutThickness;
private double _scale;
@ -86,10 +62,6 @@ namespace Avalonia.Controls
BorderBrushProperty,
BorderThicknessProperty,
CornerRadiusProperty,
BorderDashArrayProperty,
BorderLineCapProperty,
BorderLineJoinProperty,
BorderDashOffsetProperty,
BoxShadowProperty);
AffectsMeasure<Border>(BorderThicknessProperty);
}
@ -115,8 +87,8 @@ namespace Avalonia.Controls
/// </summary>
public IBrush? Background
{
get { return GetValue(BackgroundProperty); }
set { SetValue(BackgroundProperty, value); }
get => GetValue(BackgroundProperty);
set => SetValue(BackgroundProperty, value);
}
/// <summary>
@ -124,17 +96,8 @@ namespace Avalonia.Controls
/// </summary>
public IBrush? BorderBrush
{
get { return GetValue(BorderBrushProperty); }
set { SetValue(BorderBrushProperty, value); }
}
/// <summary>
/// Gets or sets a collection of <see cref="double"/> values that indicate the pattern of dashes and gaps that is used to outline shapes.
/// </summary>
public AvaloniaList<double>? BorderDashArray
{
get { return GetValue(BorderDashArrayProperty); }
set { SetValue(BorderDashArrayProperty, value); }
get => GetValue(BorderBrushProperty);
set => SetValue(BorderBrushProperty, value);
}
/// <summary>
@ -142,35 +105,8 @@ namespace Avalonia.Controls
/// </summary>
public Thickness BorderThickness
{
get { return GetValue(BorderThicknessProperty); }
set { SetValue(BorderThicknessProperty, value); }
}
/// <summary>
/// Gets or sets a value that specifies the distance within the dash pattern where a dash begins.
/// </summary>
public double BorderDashOffset
{
get { return GetValue(BorderDashOffsetProperty); }
set { SetValue(BorderDashOffsetProperty, value); }
}
/// <summary>
/// Gets or sets a <see cref="PenLineCap"/> enumeration value that describes the shape at the ends of a line.
/// </summary>
public PenLineCap BorderLineCap
{
get { return GetValue(BorderLineCapProperty); }
set { SetValue(BorderLineCapProperty, value); }
}
/// <summary>
/// Gets or sets a <see cref="PenLineJoin"/> enumeration value that specifies the type of join that is used at the vertices of a Shape.
/// </summary>
public PenLineJoin BorderLineJoin
{
get { return GetValue(BorderLineJoinProperty); }
set { SetValue(BorderLineJoinProperty, value); }
get => GetValue(BorderThicknessProperty);
set => SetValue(BorderThicknessProperty, value);
}
/// <summary>
@ -178,8 +114,8 @@ namespace Avalonia.Controls
/// </summary>
public CornerRadius CornerRadius
{
get { return GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
get => GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}
/// <summary>
@ -227,8 +163,14 @@ namespace Avalonia.Controls
/// <param name="context">The drawing context.</param>
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);
}
/// <summary>

32
src/Avalonia.Controls/Shapes/Shape.cs

@ -126,8 +126,8 @@ namespace Avalonia.Controls.Shapes
/// </summary>
public IBrush? Fill
{
get { return GetValue(FillProperty); }
set { SetValue(FillProperty, value); }
get => GetValue(FillProperty);
set => SetValue(FillProperty, value);
}
/// <summary>
@ -135,8 +135,8 @@ namespace Avalonia.Controls.Shapes
/// </summary>
public Stretch Stretch
{
get { return GetValue(StretchProperty); }
set { SetValue(StretchProperty, value); }
get => GetValue(StretchProperty);
set => SetValue(StretchProperty, value);
}
/// <summary>
@ -144,8 +144,8 @@ namespace Avalonia.Controls.Shapes
/// </summary>
public IBrush? Stroke
{
get { return GetValue(StrokeProperty); }
set { SetValue(StrokeProperty, value); }
get => GetValue(StrokeProperty);
set => SetValue(StrokeProperty, value);
}
/// <summary>
@ -153,8 +153,8 @@ namespace Avalonia.Controls.Shapes
/// </summary>
public AvaloniaList<double>? StrokeDashArray
{
get { return GetValue(StrokeDashArrayProperty); }
set { SetValue(StrokeDashArrayProperty, value); }
get => GetValue(StrokeDashArrayProperty);
set => SetValue(StrokeDashArrayProperty, value);
}
/// <summary>
@ -162,8 +162,8 @@ namespace Avalonia.Controls.Shapes
/// </summary>
public double StrokeDashOffset
{
get { return GetValue(StrokeDashOffsetProperty); }
set { SetValue(StrokeDashOffsetProperty, value); }
get => GetValue(StrokeDashOffsetProperty);
set => SetValue(StrokeDashOffsetProperty, value);
}
/// <summary>
@ -171,8 +171,8 @@ namespace Avalonia.Controls.Shapes
/// </summary>
public double StrokeThickness
{
get { return GetValue(StrokeThicknessProperty); }
set { SetValue(StrokeThicknessProperty, value); }
get => GetValue(StrokeThicknessProperty);
set => SetValue(StrokeThicknessProperty, value);
}
/// <summary>
@ -180,8 +180,8 @@ namespace Avalonia.Controls.Shapes
/// </summary>
public PenLineCap StrokeLineCap
{
get { return GetValue(StrokeLineCapProperty); }
set { SetValue(StrokeLineCapProperty, value); }
get => GetValue(StrokeLineCapProperty);
set => SetValue(StrokeLineCapProperty, value);
}
/// <summary>
@ -189,8 +189,8 @@ namespace Avalonia.Controls.Shapes
/// </summary>
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)

Loading…
Cancel
Save