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 @@ -576,7 +576,7 @@ internal void UpdateEmptyViewVisibility()
SwapAdapter(_emptyViewAdapter, true);

// TODO hartez 2018/10/24 17:34:36 If this works, cache this layout manager as _emptyLayoutManager
SetLayoutManager(new LinearLayoutManager(Context));
SetLayoutManager(SelectLayoutManager(ItemsLayout));
UpdateEmptyView();
}
else if (!showEmptyView && currentAdapter != ItemsViewAdapter)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue28622.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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.Issue28622">
<Grid RowDefinitions="100,Auto,Auto,Auto,Auto">
<CollectionView x:Name="collectionView"
BackgroundColor="Gray">
</CollectionView>
<Button Clicked="OnLayoutButtonClicked"
AutomationId="LayoutButton"
Grid.Row="1"
Text="Change Itemslayout"/>
<Button Clicked="OnHeaderButtonClicked"
AutomationId="HeaderButton"
Grid.Row="2"
Text="Add Header"/>
<Button Clicked="OnFooterButtonClicked"
AutomationId="FooterButton"
Grid.Row="3"
Text="Add Footer"/>
<Button Clicked="OnEmptyViewButtonClicked"
AutomationId="EmptyViewButton"
Grid.Row="4"
Text="Add EmptyView"/>
</Grid>
</ContentPage>
30 changes: 30 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue28622.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 28622, "[Android] CollectionView Header and Footer Do Not Align with Horizontal ItemsLayout When EmptyView is Displayed", PlatformAffected.Android)]
public partial class Issue28622 : ContentPage
{
public Issue28622()
{
InitializeComponent();
}

private void OnLayoutButtonClicked(object sender, EventArgs e)
{
collectionView.ItemsLayout = new LinearItemsLayout(ItemsLayoutOrientation.Horizontal);
}

private void OnHeaderButtonClicked(object sender, EventArgs e)
{
collectionView.Header = "CollectionView Header(String)";
}

private void OnFooterButtonClicked(object sender, EventArgs e)
{
collectionView.Footer = "CollectionView Footer(String)";
}

private void OnEmptyViewButtonClicked(object sender, EventArgs e)
{
collectionView.EmptyView = "EmptyView String";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS
//https://github.com/dotnet/maui/issues/27946 In Windows, dynamically changing the ItemsLayout does not work.
// https://github.com/dotnet/maui/issues/28678 On iOS and Mac, in Cv2, changing the ItemsLayout throws an exception. In Cv1, the EmptyView overlaps.
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

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

public override string Issue => "[Android] CollectionView Header and Footer Do Not Align with Horizontal ItemsLayout When EmptyView is Displayed";

[Test]
[Category(UITestCategories.CollectionView)]
public void ItemsLayoutShouldRenderProperlyOnEmptyView()
{
App.WaitForElement("LayoutButton");
App.Tap("LayoutButton");
App.Tap("HeaderButton");
App.Tap("FooterButton");
App.Tap("EmptyViewButton");
VerifyScreenshot();
}
}
#endif
Loading