Browse Source

Merge branch 'master' into fixes/2284-deffered-renderer-nre

danwalmsley 6 years ago
parent
commit
59492694f6
2 changed files with 19 additions and 11 deletions
  1. 8 9
      .github/PULL_REQUEST_TEMPLATE.md
  2. 11 2
      src/Avalonia.Controls/Shapes/Shape.cs

+ 8 - 9
.github/PULL_REQUEST_TEMPLATE.md

@@ -1,18 +1,18 @@
 ## What does the pull request do?
+<!--- Give a bit of background on the PR here, together with links to with related issues etc. -->
 
-Give a bit of background on the PR here, together with links to with related issues etc.
 
 ## What is the current behavior?
+<!--- If the PR is a fix, describe the current incorrect behavior, otherwise delete this section. -->
 
-If the PR is a fix, describe the current incorrect behavior, otherwise delete this section.
 
 ## What is the updated/expected behavior with this PR?
+<!--- Describe how to test the PR. -->
 
-Describe how to test the PR.
 
 ## How was the solution implemented (if it's not obvious)?
+<!--- Include any information that might be of use to a reviewer here. -->
 
-Include any information that might be of use to a reviewer here.
 
 ## Checklist
 
@@ -21,12 +21,11 @@ Include any information that might be of use to a reviewer here.
 - [ ] Consider submitting a PR to https://github.com/AvaloniaUI/Avaloniaui.net with user documentation
 
 ## Breaking changes
+<!--- List any breaking changes here. When the PR is merged please add an entry to https://github.com/AvaloniaUI/Avalonia/wiki/Breaking-Changes -->
 
-List any breaking changes here. When the PR is merged please add an entry to https://github.com/AvaloniaUI/Avalonia/wiki/Breaking-Changes
 
 ## Fixed issues
-
-If the pull request fixes issue(s) list them like this:
-
+<!--- If the pull request fixes issue(s) list them like this: 
 Fixes #123
-Fixes #456
+Fixes #456
+-->

+ 11 - 2
src/Avalonia.Controls/Shapes/Shape.cs

@@ -20,7 +20,10 @@ namespace Avalonia.Controls.Shapes
             AvaloniaProperty.Register<Shape, IBrush>(nameof(Stroke));
 
         public static readonly StyledProperty<AvaloniaList<double>> StrokeDashArrayProperty =
-            AvaloniaProperty.Register<Shape, AvaloniaList<double>>("StrokeDashArray");
+            AvaloniaProperty.Register<Shape, AvaloniaList<double>>(nameof(StrokeDashArray));
+            
+        public static readonly StyledProperty<double> StrokeDashOffsetProperty =
+            AvaloniaProperty.Register<Shape, double>(nameof(StrokeDashOffset));
 
         public static readonly StyledProperty<double> StrokeThicknessProperty =
             AvaloniaProperty.Register<Shape, double>(nameof(StrokeThickness));
@@ -103,6 +106,12 @@ namespace Avalonia.Controls.Shapes
             get { return GetValue(StrokeDashArrayProperty); }
             set { SetValue(StrokeDashArrayProperty, value); }
         }
+        
+        public double StrokeDashOffset
+        {
+            get { return GetValue(StrokeDashOffsetProperty); }
+            set { SetValue(StrokeDashOffsetProperty, value); }
+        }
 
         public double StrokeThickness
         {
@@ -124,7 +133,7 @@ namespace Avalonia.Controls.Shapes
 
             if (geometry != null)
             {
-                var pen = new Pen(Stroke, StrokeThickness, new DashStyle(StrokeDashArray), 
+                var pen = new Pen(Stroke, StrokeThickness, new DashStyle(StrokeDashArray, StrokeDashOffset), 
                     StrokeDashCap, StrokeStartLineCap, StrokeEndLineCap, StrokeJoin);
                 context.DrawGeometry(Fill, pen, geometry);
             }