@@ -20,6 +20,8 @@ public class MauiPageControl : ItemsControl
20
20
WBrush ? _fillColor ;
21
21
ObservableCollection < WShape > ? _dots ;
22
22
23
+ internal bool UseShapeIndicator => _indicatorView == null || ( _indicatorView is ITemplatedIndicatorView templatedView && templatedView . IndicatorsLayoutOverride != null ) ;
24
+
23
25
public MauiPageControl ( )
24
26
{
25
27
HorizontalAlignment = Microsoft . UI . Xaml . HorizontalAlignment . Center ;
@@ -35,17 +37,17 @@ public void SetIndicatorView(IIndicatorView indicatorView)
35
37
}
36
38
37
39
internal void UpdateIndicatorsColor ( )
38
- {
39
- if ( _indicatorView is null || ( _indicatorView is ITemplatedIndicatorView templatedView && templatedView . IndicatorsLayoutOverride is not null ) )
40
+ {
41
+ if ( UseShapeIndicator )
40
42
{
41
43
return ;
42
44
}
43
45
44
- if ( _indicatorView . IndicatorColor is SolidPaint solidPaint )
46
+ if ( _indicatorView ? . IndicatorColor is SolidPaint solidPaint )
45
47
_fillColor = solidPaint ? . ToPlatform ( ) ;
46
- if ( _indicatorView . SelectedIndicatorColor is SolidPaint selectedSolidPaint )
48
+ if ( _indicatorView ? . SelectedIndicatorColor is SolidPaint selectedSolidPaint )
47
49
_selectedColor = selectedSolidPaint . ToPlatform ( ) ;
48
- var position = _indicatorView . Position ;
50
+ var position = _indicatorView ? . Position ;
49
51
int i = 0 ;
50
52
foreach ( var item in Items )
51
53
{
@@ -56,15 +58,15 @@ internal void UpdateIndicatorsColor()
56
58
57
59
internal void CreateIndicators ( )
58
60
{
59
- if ( _indicatorView is null || ( _indicatorView is ITemplatedIndicatorView templatedView && templatedView . IndicatorsLayoutOverride is not null ) )
61
+ if ( UseShapeIndicator )
60
62
{
61
63
return ;
62
64
}
63
65
64
66
var position = GetIndexFromPosition ( ) ;
65
67
var indicators = new List < WShape > ( ) ;
66
68
67
- var indicatorCount = _indicatorView . GetMaximumVisible ( ) ;
69
+ var indicatorCount = _indicatorView ? . GetMaximumVisible ( ) ;
68
70
if ( indicatorCount > 0 )
69
71
{
70
72
for ( int i = 0 ; i < indicatorCount ; i ++ )
0 commit comments