Skip to content

Commit a66f04a

Browse files
[Windows] Fix for 7144 ( IndicatorView using templated icons not working )
1 parent 721c174 commit a66f04a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Core/src/Platform/Windows/MauiPageControl.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class MauiPageControl : ItemsControl
2020
WBrush? _fillColor;
2121
ObservableCollection<WShape>? _dots;
2222

23+
internal bool UseShapeIndicator => _indicatorView == null || (_indicatorView is ITemplatedIndicatorView templatedView && templatedView.IndicatorsLayoutOverride != null);
24+
2325
public MauiPageControl()
2426
{
2527
HorizontalAlignment = Microsoft.UI.Xaml.HorizontalAlignment.Center;
@@ -35,17 +37,17 @@ public void SetIndicatorView(IIndicatorView indicatorView)
3537
}
3638

3739
internal void UpdateIndicatorsColor()
38-
{
39-
if (_indicatorView is null || (_indicatorView is ITemplatedIndicatorView templatedView && templatedView.IndicatorsLayoutOverride is not null))
40+
{
41+
if (UseShapeIndicator)
4042
{
4143
return;
4244
}
4345

44-
if (_indicatorView.IndicatorColor is SolidPaint solidPaint)
46+
if (_indicatorView?.IndicatorColor is SolidPaint solidPaint)
4547
_fillColor = solidPaint?.ToPlatform();
46-
if (_indicatorView.SelectedIndicatorColor is SolidPaint selectedSolidPaint)
48+
if (_indicatorView?.SelectedIndicatorColor is SolidPaint selectedSolidPaint)
4749
_selectedColor = selectedSolidPaint.ToPlatform();
48-
var position = _indicatorView.Position;
50+
var position = _indicatorView?.Position;
4951
int i = 0;
5052
foreach (var item in Items)
5153
{
@@ -56,15 +58,15 @@ internal void UpdateIndicatorsColor()
5658

5759
internal void CreateIndicators()
5860
{
59-
if (_indicatorView is null || (_indicatorView is ITemplatedIndicatorView templatedView && templatedView.IndicatorsLayoutOverride is not null))
61+
if (UseShapeIndicator)
6062
{
6163
return;
6264
}
6365

6466
var position = GetIndexFromPosition();
6567
var indicators = new List<WShape>();
6668

67-
var indicatorCount = _indicatorView.GetMaximumVisible();
69+
var indicatorCount = _indicatorView?.GetMaximumVisible();
6870
if (indicatorCount > 0)
6971
{
7072
for (int i = 0; i < indicatorCount; i++)

0 commit comments

Comments
 (0)