@@ -611,7 +611,7 @@ private void InitializeClockFaceCanvas()
611
611
this . ClockFaceCanvas = new Canvas
612
612
{
613
613
RenderTransform = this . ClockFaceScaleTransform ,
614
- Background = Brushes . PaleVioletRed ,
614
+ Background = Brushes . Transparent ,
615
615
Width = this . Diameter ,
616
616
Height = this . Diameter ,
617
617
HorizontalAlignment = HorizontalAlignment . Left ,
@@ -889,6 +889,8 @@ protected virtual void OnSelectedMinuteChanged(double oldValue, double newValue)
889
889
this . HourHandTransform . Angle = angle ;
890
890
}
891
891
892
+ DrawArcFromZeroToCurrent ( ) ;
893
+
892
894
if ( this . IsUpdatingSelectedTime )
893
895
{
894
896
return ;
@@ -1124,6 +1126,35 @@ protected virtual void DrawAnalogClock()
1124
1126
return ;
1125
1127
}
1126
1128
1129
+ DrawIntervals ( ) ;
1130
+ DrawClockFaceBackground ( ) ;
1131
+ DrawSelectionArcs ( ) ;
1132
+
1133
+ if ( this . IsDisplayDateEnabled )
1134
+ {
1135
+ AddDateElement ( ) ;
1136
+ }
1137
+
1138
+ AddClockHands ( ) ;
1139
+ OnClockFaceLoaded ( ) ;
1140
+ }
1141
+
1142
+ private void DrawSelectionArcs ( )
1143
+ {
1144
+ if ( ! this . IsMinuteSelectionArcEnabled )
1145
+ {
1146
+ return ;
1147
+ }
1148
+
1149
+ AddElementToClockFace (
1150
+ this . SelectedMinuteArcRectangle ,
1151
+ new Point ( ) ,
1152
+ 1 ) ;
1153
+ DrawArcFromZeroToCurrent ( ) ;
1154
+ }
1155
+
1156
+ private void DrawIntervals ( )
1157
+ {
1127
1158
double steps = 60.0 ;
1128
1159
double degreeOfStep = 360.0 / steps ;
1129
1160
this . IntervalMarkerCenterRadius = - 1 ;
@@ -1139,32 +1170,17 @@ protected virtual void DrawAnalogClock()
1139
1170
1140
1171
DrawIntervalMarker ( degreesOfCurrentStep , intervalMarker ) ;
1141
1172
1142
- if ( this . IsDisplayIntervalLabelsEnabled )
1173
+ if ( ! this . IsDisplayIntervalLabelsEnabled )
1143
1174
{
1144
- FrameworkElement intervalMarkerLabel = CreateIntervalLabel ( step ) ;
1145
- if ( intervalMarkerLabel != null )
1146
- {
1147
- DrawIntervalLabel ( degreesOfCurrentStep , intervalMarkerLabel ) ;
1148
- }
1175
+ continue ;
1149
1176
}
1150
- }
1151
1177
1152
- DrawClockFaceBackground ( ) ;
1153
- if ( this . IsMinuteSelectionArcEnabled )
1154
- {
1155
- AddElementToClockFace (
1156
- this . SelectedMinuteArcRectangle ,
1157
- new Point ( ) ) ;
1158
- DrawArcFromZeroToCurrent ( ) ;
1159
- }
1160
-
1161
- if ( this . IsDisplayDateEnabled )
1162
- {
1163
- AddDateElement ( ) ;
1178
+ FrameworkElement intervalMarkerLabel = CreateIntervalLabel ( step ) ;
1179
+ if ( intervalMarkerLabel != null )
1180
+ {
1181
+ DrawIntervalLabel ( degreesOfCurrentStep , intervalMarkerLabel ) ;
1182
+ }
1164
1183
}
1165
-
1166
- AddClockHands ( ) ;
1167
- OnClockFaceLoaded ( ) ;
1168
1184
}
1169
1185
1170
1186
protected virtual void DrawAnalog24Clock ( )
@@ -1261,7 +1277,7 @@ private void AddDateElement()
1261
1277
return ;
1262
1278
}
1263
1279
1264
- AddElementToClockFace ( this . DateElement , new Point ( Canvas . GetLeft ( this . DateElement ) , Canvas . GetTop ( this . DateElement ) ) ) ;
1280
+ AddElementToClockFace ( this . DateElement , new Point ( Canvas . GetLeft ( this . DateElement ) , Canvas . GetTop ( this . DateElement ) ) , 2 ) ;
1265
1281
}
1266
1282
1267
1283
private void DrawClockFaceBackground ( )
@@ -1296,7 +1312,7 @@ private void DrawArcFromZeroToCurrent()
1296
1312
this . SelectedMinuteArcPoint ,
1297
1313
this . SelectionArcSize ,
1298
1314
0 ,
1299
- true ,
1315
+ this . IsLargeSelectionMinuteArc ,
1300
1316
SweepDirection . Clockwise ,
1301
1317
false )
1302
1318
} ,
@@ -1320,7 +1336,7 @@ private void DrawIntervalLabel(double degreesOfCurrentStep, FrameworkElement int
1320
1336
Point cartesianPoint ;
1321
1337
cartesianPoint = GetCartesianPointOfStep ( degreesOfCurrentStep , this . IntervalMarkerCenterRadius + this . IntervalLabelRadiusOffset ) ;
1322
1338
AlignElementCenterPointToRadius ( ref cartesianPoint , intervalMarkerLabel ) ;
1323
- AddCartesianElementToClockFace ( intervalMarkerLabel , cartesianPoint ) ;
1339
+ AddCartesianElementToClockFace ( intervalMarkerLabel , cartesianPoint , 2 ) ;
1324
1340
}
1325
1341
1326
1342
private void DrawIntervalMarker (
@@ -1334,7 +1350,7 @@ private void DrawIntervalMarker(
1334
1350
AlignElementCenterPointToRadius ( ref cartesianPoint , intervalMarker ) ;
1335
1351
}
1336
1352
1337
- AddCartesianElementToClockFace ( intervalMarker , cartesianPoint ) ;
1353
+ AddCartesianElementToClockFace ( intervalMarker , cartesianPoint , 2 ) ;
1338
1354
}
1339
1355
1340
1356
private static void RotateIntervalMarker ( double degreesOfCurrentStep , FrameworkElement intervalMarker )
@@ -1443,15 +1459,15 @@ private void AddClockHands()
1443
1459
{
1444
1460
if ( this . HourHandElement != null )
1445
1461
{
1446
- AddElementToClockFace ( this . HourHandElement , new Point ( Canvas . GetLeft ( this . HourHandElement ) , Canvas . GetTop ( this . HourHandElement ) ) , Panel . GetZIndex ( this . HourHandElement ) + 2 ) ;
1462
+ AddElementToClockFace ( this . HourHandElement , new Point ( Canvas . GetLeft ( this . HourHandElement ) , Canvas . GetTop ( this . HourHandElement ) ) , Panel . GetZIndex ( this . HourHandElement ) + 3 ) ;
1447
1463
}
1448
1464
if ( this . MinuteHandElement != null )
1449
1465
{
1450
- AddElementToClockFace ( this . MinuteHandElement , new Point ( Canvas . GetLeft ( this . MinuteHandElement ) , Canvas . GetTop ( this . MinuteHandElement ) ) , Panel . GetZIndex ( this . MinuteHandElement ) + 3 ) ;
1466
+ AddElementToClockFace ( this . MinuteHandElement , new Point ( Canvas . GetLeft ( this . MinuteHandElement ) , Canvas . GetTop ( this . MinuteHandElement ) ) , Panel . GetZIndex ( this . MinuteHandElement ) + 4 ) ;
1451
1467
}
1452
1468
if ( this . SecondHandElement != null )
1453
1469
{
1454
- AddElementToClockFace ( this . SecondHandElement , new Point ( Canvas . GetLeft ( this . SecondHandElement ) , Canvas . GetTop ( this . SecondHandElement ) ) , Panel . GetZIndex ( this . SecondHandElement ) + 4 ) ;
1470
+ AddElementToClockFace ( this . SecondHandElement , new Point ( Canvas . GetLeft ( this . SecondHandElement ) , Canvas . GetTop ( this . SecondHandElement ) ) , Panel . GetZIndex ( this . SecondHandElement ) + 5 ) ;
1455
1471
}
1456
1472
}
1457
1473
@@ -1485,10 +1501,10 @@ private Point GetCartesianPointOfStep(double degreesOfCurrentStep, double radius
1485
1501
return cartesianPoint ;
1486
1502
}
1487
1503
1488
- public void AddCartesianElementToClockFace ( FrameworkElement clockElement , Point cartesianPoint )
1504
+ public void AddCartesianElementToClockFace ( FrameworkElement clockElement , Point cartesianPoint , int zIndex = 1 )
1489
1505
{
1490
1506
Point screenPoint = cartesianPoint . ToScreenPoint ( this . Diameter ) ;
1491
- AddElementToClockFace ( clockElement , screenPoint ) ;
1507
+ AddElementToClockFace ( clockElement , screenPoint , zIndex ) ;
1492
1508
}
1493
1509
1494
1510
public void AddElementToClockFace ( FrameworkElement clockElement , Point screenPoint , int zIndex = 1 )
0 commit comments