7
7
using System . Windows . Shapes ;
8
8
using Point = System . Windows . Point ;
9
9
using Size = System . Windows . Size ;
10
- // ReSharper disable CheckNamespace
11
- #pragma warning disable CS0108
12
10
11
+ // ReSharper disable CheckNamespace
13
12
namespace Wpf . Ui . Controls ;
14
13
15
14
/// <summary>
@@ -46,22 +45,20 @@ public class Arc : Shape
46
45
) ;
47
46
48
47
/// <summary>Identifies the <see cref="SweepDirection"/> dependency property.</summary>
49
- public static readonly DependencyProperty SweepDirectionProperty =
50
- DependencyProperty . Register (
51
- nameof ( SweepDirection ) ,
52
- typeof ( SweepDirection ) ,
53
- typeof ( Arc ) ,
54
- new PropertyMetadata ( SweepDirection . Clockwise , PropertyChangedCallback )
55
- ) ;
48
+ public static readonly DependencyProperty SweepDirectionProperty = DependencyProperty . Register (
49
+ nameof ( SweepDirection ) ,
50
+ typeof ( SweepDirection ) ,
51
+ typeof ( Arc ) ,
52
+ new PropertyMetadata ( SweepDirection . Clockwise , PropertyChangedCallback )
53
+ ) ;
56
54
57
55
/// <summary>Identifies the <see cref="StrokeStartLineCap"/> dependency property.</summary>
58
- public static readonly DependencyProperty StrokeStartLineCapProperty =
59
- DependencyProperty . Register (
60
- nameof ( StrokeStartLineCap ) ,
61
- typeof ( PenLineCap ) ,
62
- typeof ( Arc ) ,
63
- new PropertyMetadata ( PenLineCap . Round , PropertyChangedCallback )
64
- ) ;
56
+ public static readonly DependencyProperty StrokeStartLineCapProperty = DependencyProperty . Register (
57
+ nameof ( StrokeStartLineCap ) ,
58
+ typeof ( PenLineCap ) ,
59
+ typeof ( Arc ) ,
60
+ new PropertyMetadata ( PenLineCap . Round , PropertyChangedCallback )
61
+ ) ;
65
62
66
63
/// <summary>
67
64
/// Gets or sets the initial angle from which the arc will be drawn.
@@ -90,7 +87,8 @@ public SweepDirection SweepDirection
90
87
set => SetValue ( SweepDirectionProperty , value ) ;
91
88
}
92
89
93
- public PenLineCap StrokeStartLineCap
90
+ // TODO: Should we?
91
+ public new PenLineCap StrokeStartLineCap
94
92
{
95
93
get { return ( PenLineCap ) GetValue ( StrokeStartLineCapProperty ) ; }
96
94
set { SetValue ( StrokeStartLineCapProperty , value ) ; }
@@ -165,7 +163,10 @@ protected Point PointAtAngle(double angle)
165
163
var xRadius = ( RenderSize . Width - StrokeThickness ) / 2 ;
166
164
var yRadius = ( RenderSize . Height - StrokeThickness ) / 2 ;
167
165
168
- return new Point ( xRadius + ( xRadius * Math . Cos ( radAngle ) ) , yRadius - ( yRadius * Math . Sin ( radAngle ) ) ) ;
166
+ return new Point (
167
+ xRadius + ( xRadius * Math . Cos ( radAngle ) ) ,
168
+ yRadius - ( yRadius * Math . Sin ( radAngle ) )
169
+ ) ;
169
170
}
170
171
else
171
172
{
@@ -180,7 +181,10 @@ protected Point PointAtAngle(double angle)
180
181
var xRadius = ( RenderSize . Width - StrokeThickness ) / 2 ;
181
182
var yRadius = ( RenderSize . Height - StrokeThickness ) / 2 ;
182
183
183
- return new Point ( xRadius + ( xRadius * Math . Cos ( - radAngle ) ) , yRadius - ( yRadius * Math . Sin ( - radAngle ) ) ) ;
184
+ return new Point (
185
+ xRadius + ( xRadius * Math . Cos ( - radAngle ) ) ,
186
+ yRadius - ( yRadius * Math . Sin ( - radAngle ) )
187
+ ) ;
184
188
}
185
189
}
186
190
@@ -231,11 +235,12 @@ protected override Size ArrangeOverride(Size finalSize)
231
235
protected override void OnRender ( DrawingContext drawingContext )
232
236
{
233
237
base . OnRender ( drawingContext ) ;
234
- Pen pen = new ( Stroke , StrokeThickness )
235
- {
236
- StartLineCap = StrokeStartLineCap ,
237
- EndLineCap = StrokeStartLineCap
238
- } ;
238
+ Pen pen =
239
+ new ( Stroke , StrokeThickness )
240
+ {
241
+ StartLineCap = StrokeStartLineCap ,
242
+ EndLineCap = StrokeStartLineCap
243
+ } ;
239
244
240
245
drawingContext . DrawGeometry ( Stroke , pen , DefinedGeometry ( ) ) ;
241
246
}
0 commit comments