Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -270,7 +270,7 @@ void InvalidateMeasureIfContentSizeChanged()
}


internal Size? GetSize()
internal virtual Size? GetSize()
{
if (_emptyViewDisplayed)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable disable
using System;
using CoreGraphics;
using Microsoft.Maui.Graphics;
using ObjCRuntime;
using UIKit;

Expand Down Expand Up @@ -240,6 +241,12 @@ protected override void HandleFormsElementMeasureInvalidated(VisualElement forms
UpdateHeaderFooterPosition();
}

internal override Size? GetSize()
{
var size = base.GetSize();
return new Size(size.Value.Width, size.Value.Height + (_headerUIView?.Frame.Height ?? 0) + (_footerUIView?.Frame.Height ?? 0));
}

internal void UpdateLayoutMeasurements()
{
if (_headerViewFormsElement != null)
Expand Down
34 changes: 34 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue27808.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue27808">
<VerticalStackLayout>
<CollectionView>
<CollectionView.ItemsSource>
<Array Type="{x:Type x:String}">
<x:String>item1</x:String>
<x:String>item2</x:String>
<x:String>item3</x:String>
</Array>
</CollectionView.ItemsSource>
<CollectionView.ItemTemplate>
<DataTemplate>
<Label AutomationId="{Binding .}"
Text="{Binding .}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
<CollectionView.HeaderTemplate>
<DataTemplate>
<BoxView HeightRequest="100"
BackgroundColor="Green"/>
</DataTemplate>
</CollectionView.HeaderTemplate>
<CollectionView.FooterTemplate>
<DataTemplate>
<BoxView HeightRequest="200"
BackgroundColor="Blue"/>
</DataTemplate>
</CollectionView.FooterTemplate>
</CollectionView>
</VerticalStackLayout>
</ContentPage>
10 changes: 10 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue27808.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 27808, "CollectionView with header or footer has incorrect height", PlatformAffected.iOS)]
public partial class Issue27808 : ContentPage
{
public Issue27808()
{
InitializeComponent();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue27808 : _IssuesUITest
{
public Issue27808(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "CollectionView with header or footer has incorrect height";

[Test]
[Category(UITestCategories.CollectionView)]
public void CollectionViewShouldHaveCorrectHeight()
{
App.WaitForElement("item3");
}
}
}
Loading