-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[iOS] Fix for CollectionView single item horizontal alignment issue w…
…hen using ItemsLayout with a Footer. (#24564) * fix added for collectionView single item alignment with footer, * Test sample changes. * Modified the automation sample. * Added automation images. * Added comments.
- Loading branch information
1 parent
64343f5
commit 7d6c5a9
Showing
7 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+12.2 KB
...Android.Tests/snapshots/android/CollectionViewSingleItemAlignmentWithFooter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
src/Controls/tests/TestCases.HostApp/Issues/Issue21728.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?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.Issue21728" | ||
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues"> | ||
<CollectionView x:Name="collectionview" AutomationId="collectionview" ItemsLayout="VerticalGrid, 2"> | ||
<CollectionView.ItemTemplate> | ||
<DataTemplate> | ||
<Label Text="{Binding Name}" BackgroundColor="Red" HeightRequest="200" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"/> | ||
</DataTemplate> | ||
</CollectionView.ItemTemplate> | ||
<CollectionView.Footer> | ||
<ContentView > | ||
<ContentView.ControlTemplate> | ||
<ControlTemplate> | ||
<Label Text="CollectionView Footer"/> | ||
</ControlTemplate> | ||
</ContentView.ControlTemplate> | ||
</ContentView> | ||
</CollectionView.Footer> | ||
</CollectionView> | ||
</ContentPage> |
26 changes: 26 additions & 0 deletions
26
src/Controls/tests/TestCases.HostApp/Issues/Issue21728.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Microsoft.Maui.Controls; | ||
|
||
namespace Maui.Controls.Sample.Issues; | ||
|
||
[Issue(IssueTracker.Github, 21728, "CollectionView item alignment issue when a single item is present with a footer", PlatformAffected.iOS)] | ||
public partial class Issue21728 : ContentPage | ||
{ | ||
public IList<TestItem> Items { get; set; } | ||
|
||
public Issue21728() | ||
{ | ||
InitializeComponent(); | ||
BindingContext = this; | ||
Items = new List<TestItem>(); | ||
Items.Add(new TestItem() { Name = "Test Item 1" }); | ||
collectionview.ItemsSource = Items; | ||
} | ||
|
||
public class TestItem | ||
{ | ||
public string Name { get; set; } | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21728.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#if !MACCATALYST | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
public class Issue21728 : _IssuesUITest | ||
{ | ||
public override string Issue => "CollectionView item alignment issue when a single item is present with a footer"; | ||
|
||
public Issue21728(TestDevice device) | ||
: base(device) | ||
{ } | ||
|
||
[Test] | ||
[Category(UITestCategories.CollectionView)] | ||
public void CollectionViewSingleItemAlignmentWithFooter() | ||
{ | ||
App.WaitForElement("collectionview"); | ||
|
||
VerifyScreenshot(); | ||
} | ||
} | ||
} | ||
#endif |
Binary file added
BIN
+6.43 KB
...s.WinUI.Tests/snapshots/windows/CollectionViewSingleItemAlignmentWithFooter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.5 KB
...stCases.iOS.Tests/snapshots/ios/CollectionViewSingleItemAlignmentWithFooter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.