Skip to content

Commit d92ea5c

Browse files
[Windows] Fix for 7144 ( IndicatorView using templated icons not working )
1 parent 953ce0b commit d92ea5c

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

src/Controls/tests/TestCases.HostApp/Issues/Issue7144.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Controls.TestCases.HostApp.Issues;
55
[Issue(IssueTracker.Github, 7144, "IndicatorView using templated icons not working", PlatformAffected.UWP)]
66
public class Issue7144 : ContentPage
77
{
8-
public ObservableCollection<Monkey> Monkeys { get; set; } = new ObservableCollection<Monkey>();
8+
public ObservableCollection<Issue7144Monkey> Monkeys { get; set; } = new ObservableCollection<Issue7144Monkey>();
99

1010
public Issue7144()
1111
{
@@ -88,21 +88,21 @@ public Issue7144()
8888

8989
void CreateMonkeyCollection()
9090
{
91-
Monkeys.Add(new Monkey
91+
Monkeys.Add(new Issue7144Monkey
9292
{
9393
Name = "Baboon",
9494
Image = "dotnet_bot.png"
9595
});
9696

97-
Monkeys.Add(new Monkey
97+
Monkeys.Add(new Issue7144Monkey
9898
{
9999
Name = "Capuchin Monkey",
100100
Image = "dotnet_bot.png"
101101
});
102102
}
103103
}
104104

105-
public class Monkey
105+
public class Issue7144Monkey
106106
{
107107
public string Name { get; set; }
108108

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,18 @@ public void SetIndicatorView(IIndicatorView indicatorView)
3434
Items.Clear();
3535
}
3636

37-
private bool HasTemplate()
38-
{
39-
return _indicatorView is null || (_indicatorView is ITemplatedIndicatorView templatedView && templatedView.IndicatorsLayoutOverride is not null);
40-
}
41-
4237
internal void UpdateIndicatorsColor()
4338
{
44-
if (HasTemplate())
39+
if (_indicatorView is null || (_indicatorView is ITemplatedIndicatorView templatedView && templatedView.IndicatorsLayoutOverride is not null))
4540
{
4641
return;
4742
}
4843

49-
if (_indicatorView?.IndicatorColor is SolidPaint solidPaint)
44+
if (_indicatorView.IndicatorColor is SolidPaint solidPaint)
5045
_fillColor = solidPaint?.ToPlatform();
51-
if (_indicatorView?.SelectedIndicatorColor is SolidPaint selectedSolidPaint)
46+
if (_indicatorView.SelectedIndicatorColor is SolidPaint selectedSolidPaint)
5247
_selectedColor = selectedSolidPaint.ToPlatform();
53-
var position = _indicatorView?.Position;
48+
var position = _indicatorView.Position;
5449
int i = 0;
5550
foreach (var item in Items)
5651
{
@@ -61,15 +56,15 @@ internal void UpdateIndicatorsColor()
6156

6257
internal void CreateIndicators()
6358
{
64-
if (HasTemplate())
59+
if (_indicatorView is null || (_indicatorView is ITemplatedIndicatorView templatedView && templatedView.IndicatorsLayoutOverride is not null))
6560
{
6661
return;
6762
}
6863

6964
var position = GetIndexFromPosition();
7065
var indicators = new List<WShape>();
7166

72-
var indicatorCount = _indicatorView?.GetMaximumVisible();
67+
var indicatorCount = _indicatorView.GetMaximumVisible();
7368
if (indicatorCount > 0)
7469
{
7570
for (int i = 0; i < indicatorCount; i++)

0 commit comments

Comments
 (0)