Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -218,7 +218,7 @@ void UpdateHeaderFooterPosition()
height = ItemsViewLayout.CollectionViewContentSize.Height;
}

if (_footerUIView != null && (_footerUIView.Frame.Y != height || emptyHeight > 0 || _footerUIView.Frame.Height != footerHeight))
if (_footerUIView != null && (_footerUIView.Frame.Y != height || emptyHeight > 0 || _footerUIView.Frame.Height != footerHeight || _footerUIView.Frame.Width != CollectionView.Frame.Width))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don t we need to do something like this for the Header too on line 209 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, we should. I pushed a commit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test we can add for the code that was added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turned out that the headerView has always been reframed because of this wrong condition _headerUIView.Frame.Y != headerHeight, but it should be _headerUIView.Frame.Y != -headerHeight based on this

_headerUIView.Frame = new CoreGraphics.CGRect(0, -headerHeight, CollectionView.Frame.Width, headerHeight);

right?

{
_footerUIView.Frame = new CoreGraphics.CGRect(0, height + emptyHeight, CollectionView.Frame.Width, footerHeight);
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue28580.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?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"
xmlns:local="clr-namespace:Maui.Controls.Sample.Issues"
x:Class="Maui.Controls.Sample.Issues.Issue28580">
<Grid Padding="30">
<CollectionView>
<CollectionView.Header>
<Border
Stroke="Black"
Margin="0">
<Grid
ColumnDefinitions="*,Auto"
ColumnSpacing="5">
<Label
Grid.Column="1"
Text="add new"
HorizontalOptions="Center"
VerticalOptions="Center"
VerticalTextAlignment="Center"/>

<Label
Grid.Column="0"
Text="+"
HorizontalOptions="End"
VerticalOptions="Center"
VerticalTextAlignment="Center"/>
</Grid>
</Border>
</CollectionView.Header>

<CollectionView.Footer>
<Border
Stroke="Black"
Margin="0">
<Grid
ColumnDefinitions="*,Auto"
ColumnSpacing="5">
<Label
Grid.Column="1"
Text="add new"
AutomationId="labelInFooter"
HorizontalOptions="Center"
VerticalOptions="Center"
VerticalTextAlignment="Center"/>

<Label
Grid.Column="0"
Text="+"
HorizontalOptions="End"
VerticalOptions="Center"
VerticalTextAlignment="Center"/>
</Grid>
</Border>
</CollectionView.Footer>
</CollectionView>
</Grid>
</ContentPage>
10 changes: 10 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue28580.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 28580, "CollectionView footer sizing when source is empty")]
public partial class Issue28580 : ContentPage
{
public Issue28580()
{
InitializeComponent();
}
}
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,21 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

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

public override string Issue => "CollectionView footer sizing when source is empty";

[Test]
[Category(UITestCategories.CollectionView)]
public void FooterWithEmptyCVShouldHaveCorrectSize()
{
App.WaitForElement("labelInFooter");
VerifyScreenshot();
}
}
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