Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d0b5b3d
Fixed Grouped CollectionView items not rendered properly on Android, …
KarthikRajaKalaimani Feb 10, 2025
e114641
Testcase added
KarthikRajaKalaimani Feb 13, 2025
848062f
Testcase added
KarthikRajaKalaimani Feb 17, 2025
acad866
Testcase updated
KarthikRajaKalaimani Feb 17, 2025
754b9e4
Fix and test case modified
KarthikRajaKalaimani Feb 21, 2025
89fa29a
Updated android snapshot
KarthikRajaKalaimani Feb 21, 2025
ac5792d
Snapshot added for mac, windows and iOS platform
KarthikRajaKalaimani Feb 24, 2025
9d24e8f
Fixed Grouped CollectionView items not rendered properly on Android, …
KarthikRajaKalaimani Feb 10, 2025
1eccc71
Fix and test case modified
KarthikRajaKalaimani Feb 21, 2025
54f7eb9
Test case modified
KarthikRajaKalaimani Feb 25, 2025
e4fec2d
Snapshot for Windows and mac updated
KarthikRajaKalaimani Mar 10, 2025
293604d
Snapshot updated
KarthikRajaKalaimani Mar 10, 2025
b109d97
Test case code modified
KarthikRajaKalaimani Mar 24, 2025
fdd2b3e
Testcase updated
KarthikRajaKalaimani Feb 17, 2025
1bbe113
Fix and test case modified
KarthikRajaKalaimani Feb 21, 2025
6ad9227
Updated android snapshot
KarthikRajaKalaimani Feb 21, 2025
68fbc7d
Snapshot added for mac, windows and iOS platform
KarthikRajaKalaimani Feb 24, 2025
5d15d6b
Fixed Grouped CollectionView items not rendered properly on Android, …
KarthikRajaKalaimani Feb 10, 2025
11c1962
Fix and test case modified
KarthikRajaKalaimani Feb 21, 2025
5bcd33a
Snapshot for Windows and mac updated
KarthikRajaKalaimani Mar 10, 2025
6859db2
Snapshot updated
KarthikRajaKalaimani Mar 10, 2025
d58578b
Fix improved
KarthikRajaKalaimani Jan 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,16 @@ public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int positi

protected override void BindTemplatedItemViewHolder(TemplatedItemViewHolder templatedItemViewHolder, object context)
{
if (ItemsView.ItemSizingStrategy == ItemSizingStrategy.MeasureFirstItem)
{
templatedItemViewHolder.Bind(context, ItemsView, _reportMeasure, _size);

if (templatedItemViewHolder.ItemView is ItemContentView itemContentView)
{
itemContentView.RetrieveStaticSize = _retrieveStaticSize;
var itemViewType = templatedItemViewHolder.ItemViewType;
if (ItemsView.ItemSizingStrategy == ItemSizingStrategy.MeasureFirstItem && itemViewType != ItemViewType.Header && itemViewType != ItemViewType.Footer && itemViewType != ItemViewType.GroupHeader && itemViewType != ItemViewType.GroupFooter)
{
templatedItemViewHolder.Bind(context, ItemsView, _reportMeasure, _size);

if (templatedItemViewHolder.ItemView is ItemContentView itemContentView)
{
itemContentView.RetrieveStaticSize = _retrieveStaticSize;
}
}
}
else
{
base.BindTemplatedItemViewHolder(templatedItemViewHolder, context);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue20855.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using System.Collections.ObjectModel;
using Microsoft.Maui.Layouts;

namespace Maui.Controls.Sample.Issues
{

[Issue(IssueTracker.Github, 20855, "Grouped CollectionView items not rendered properly on Android, works on Windows", PlatformAffected.Android)]
public class Issue20855 : TestContentPage
{

protected override void Init()
{
ObservableCollection<Issue20855ItemGroup> ItemGroups = new ObservableCollection<Issue20855ItemGroup>();
var group1 = new Issue20855ItemGroup { Name = "Group 1" };
group1.Add(new Issue20855Item { Name = "Item 1", CreateDate = new DateTime(2025, 2, 20) });
group1.Add(new Issue20855Item { Name = "Item 2", CreateDate = new DateTime(2025, 2, 19) });
ItemGroups.Add(group1);
var group2 = new Issue20855ItemGroup { Name = "Group 2" };
group2.Add(new Issue20855Item { Name = "Item 3", CreateDate = new DateTime(2025, 2, 18) });
group2.Add(new Issue20855Item { Name = "Item 4", CreateDate = new DateTime(2025, 2, 17) });
ItemGroups.Add(group2);

var collectionView = new CollectionView
{
ItemsSource = ItemGroups,
IsGrouped = true,
ItemSizingStrategy = ItemSizingStrategy.MeasureFirstItem
};
collectionView.GroupHeaderTemplate = new DataTemplate(() =>
{
var label = new Label
{
FontSize = 18,
BackgroundColor = Colors.DarkGray,
TextColor = Colors.White,
Padding = new Thickness(10, 0)
};
label.SetBinding(Label.TextProperty, "Name");

return label;
});
collectionView.ItemTemplate = new DataTemplate(() =>
{
var flexLayout = new FlexLayout
{
JustifyContent = FlexJustify.SpaceBetween,
AlignItems = FlexAlignItems.Center,
HeightRequest = 100
};

var nameLabel = new Label
{
Padding = new Thickness(8, 0),
HeightRequest = 80
};
nameLabel.SetBinding(Label.TextProperty, "Name");

var dateLabel = new Label
{
Padding = new Thickness(8, 0),
HeightRequest = 85
};
dateLabel.SetBinding(Label.TextProperty, new Binding("CreateDate", stringFormat: "{0:MMM d}"));

flexLayout.Children.Add(nameLabel);
flexLayout.Children.Add(dateLabel);

return flexLayout;
});
var grid = new Grid();
grid.Children.Add(collectionView);
Content = grid;
}
}

public class Issue20855Item
{
public string Name { get; set; }
public DateTime CreateDate { get; set; }
}

public class Issue20855ItemGroup : ObservableCollection<Issue20855Item>
{
public string Name { get; set; }
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue20855 : _IssuesUITest
{

public Issue20855(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "Grouped CollectionView items not rendered properly on Android, works on Windows";

[Test]
[Category(UITestCategories.CollectionView)]
public void GroupedCollectionViewItems()
{
App.WaitForElement("Item 1");
VerifyScreenshot("GroupedCollectionViewItems");
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading