Skip to content

Commit 3ae6618

Browse files
[Windows] Fix for 7144 ( IndicatorView using templated icons not working ) SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 committed last week
1 parent d92ea5c commit 3ae6618

File tree

2 files changed

+9
-43
lines changed

2 files changed

+9
-43
lines changed

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

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ 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<Issue7144Monkey> Monkeys { get; set; } = new ObservableCollection<Issue7144Monkey>();
8+
ObservableCollection<string> Items { get; set; } = new ObservableCollection<string>() { "Item1", "Item2" };
99

1010
public Issue7144()
1111
{
12-
CreateMonkeyCollection();
13-
1412
Grid grid = new Grid();
1513
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star });
1614
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
@@ -35,78 +33,46 @@ public Issue7144()
3533
return image;
3634
});
3735

38-
CarouselView carouselViewWithIndicatorView = new CarouselView
36+
CarouselView carouselView = new CarouselView
3937
{
40-
ItemsSource = Monkeys,
38+
ItemsSource = Items,
4139
Loop = false,
4240
IndicatorView = indicatorViewWithDataTemplate,
4341
ItemTemplate = new DataTemplate(() =>
4442
{
4543
StackLayout stackLayout = new StackLayout();
4644

47-
Label nameLabel = new Label
45+
Label label = new Label
4846
{
4947
FontAttributes = FontAttributes.Bold,
5048
FontSize = 24,
5149
HorizontalOptions = LayoutOptions.Center,
5250
VerticalOptions = LayoutOptions.Center
5351
};
54-
nameLabel.SetBinding(Label.TextProperty, "Name");
55-
56-
Image image = new Image
57-
{
58-
Aspect = Aspect.Fill,
59-
HeightRequest = 150,
60-
WidthRequest = 150,
61-
HorizontalOptions = LayoutOptions.Center
62-
};
63-
image.SetBinding(Image.SourceProperty, "Image");
52+
label.SetBinding(Label.TextProperty, ".");;
6453

65-
stackLayout.Children.Add(nameLabel);
66-
stackLayout.Children.Add(image);
54+
stackLayout.Children.Add(label);
6755

6856
return stackLayout;
6957
})
7058
};
7159

7260
Label label = new Label
7361
{
74-
AutomationId = "IndicatorViewWithDataTemplate",
62+
AutomationId = "descriptionLabel",
7563
Text = "The test case fails if the IndicatorView DataTemplate is not displayed",
7664
FontAttributes = FontAttributes.Bold,
7765
FontSize = 24,
7866
HorizontalOptions = LayoutOptions.Center,
7967
VerticalOptions = LayoutOptions.Center
8068
};
8169

82-
grid.Add(carouselViewWithIndicatorView, 0, 0);
70+
grid.Add(carouselView, 0, 0);
8371
grid.Add(indicatorViewWithDataTemplate, 0, 1);
8472
grid.Add(label, 0, 2);
8573

8674
Content = grid;
8775
}
88-
89-
void CreateMonkeyCollection()
90-
{
91-
Monkeys.Add(new Issue7144Monkey
92-
{
93-
Name = "Baboon",
94-
Image = "dotnet_bot.png"
95-
});
96-
97-
Monkeys.Add(new Issue7144Monkey
98-
{
99-
Name = "Capuchin Monkey",
100-
Image = "dotnet_bot.png"
101-
});
102-
}
103-
}
104-
105-
public class Issue7144Monkey
106-
{
107-
public string Name { get; set; }
108-
109-
public string Image { get; set; }
11076
}
11177

11278

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue7144.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public Issue7144(TestDevice device) : base(device)
1616
[Category(UITestCategories.IndicatorView)]
1717
public void IndicatorViewWithTemplatedIcon()
1818
{
19-
App.WaitForElement("IndicatorViewWithDataTemplate");
19+
App.WaitForElement("descriptionLabel");
2020
VerifyScreenshot();
2121
}
2222
}

0 commit comments

Comments
 (0)