-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[iOS] Fixed Collection View header and footer update (#20210)
* Fixed Collection View header and footer update [iOS] (#19379) * Added UITest * Added pending snapshot * [iOS] Correctly fix the CollectionView mappers hierarchy --------- Co-authored-by: javiersuarezruiz@hotmail.com <javiersuarezruiz@hotmail.com> Co-authored-by: Rui Marinho <me@ruimarinho.net>
- Loading branch information
1 parent
75be404
commit 1138b62
Showing
11 changed files
with
164 additions
and
100 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/Controls/samples/Controls.Sample.UITests/Issues/Issue19379.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,41 @@ | ||
<?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.Issue19379" | ||
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues"> | ||
<VerticalStackLayout | ||
Padding="30,0" | ||
Spacing="25"> | ||
<Label | ||
AutomationId="WaitForStubControl" | ||
Text="Issue 19379"/> | ||
<CollectionView | ||
Header="{Binding CustomHeader, Mode=TwoWay}" | ||
ItemsSource="{Binding ItemList}"> | ||
<CollectionView.HeaderTemplate> | ||
<DataTemplate> | ||
<ContentView> | ||
<Label | ||
Text="{Binding Title}" | ||
BackgroundColor="Yellow" | ||
Margin="0,10"/> | ||
</ContentView> | ||
</DataTemplate> | ||
</CollectionView.HeaderTemplate> | ||
<CollectionView.ItemTemplate> | ||
<DataTemplate> | ||
<Label | ||
Text="{Binding .}" | ||
BackgroundColor="SkyBlue" | ||
Margin="10" | ||
VerticalOptions="Center" | ||
VerticalTextAlignment="Center"/> | ||
</DataTemplate> | ||
</CollectionView.ItemTemplate> | ||
</CollectionView> | ||
<Button | ||
AutomationId="UpdateButton" | ||
Text="Update the CollectionView header" | ||
Clicked="Button_Clicked"/> | ||
</VerticalStackLayout> | ||
</ContentPage> |
82 changes: 82 additions & 0 deletions
82
src/Controls/samples/Controls.Sample.UITests/Issues/Issue19379.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,82 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Xaml; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
[Issue(IssueTracker.Github, 19379, "Not able to update CollectionView header", PlatformAffected.iOS)] | ||
public partial class Issue19379 : ContentPage | ||
{ | ||
int _initValue; | ||
IList<string> _itemList; | ||
Issue19379CustomHeader _customHeader; | ||
|
||
public Issue19379() | ||
{ | ||
InitializeComponent(); | ||
BindingContext = this; | ||
|
||
PopulateList(); | ||
CustomHeader = new Issue19379CustomHeader | ||
{ | ||
Title = "This is a CollectionViewHeader" | ||
}; | ||
} | ||
|
||
void Button_Clicked(object sender, EventArgs e) | ||
{ | ||
_initValue++; | ||
CustomHeader = new Issue19379CustomHeader | ||
{ | ||
Title = $"This is a CollectionViewHeader #{_initValue}" | ||
}; | ||
} | ||
|
||
void PopulateList() | ||
{ | ||
ItemList = new List<string>() | ||
{ | ||
"This is an item", | ||
"This is an item", | ||
"This is an item", | ||
"This is an item", | ||
"This is an item", | ||
"This is an item" | ||
}; | ||
} | ||
|
||
protected override void OnAppearing() | ||
{ | ||
base.OnAppearing(); | ||
} | ||
|
||
|
||
|
||
public IList<string> ItemList | ||
{ | ||
get { return _itemList; } | ||
set | ||
{ | ||
_itemList = value; | ||
OnPropertyChanged(); | ||
} | ||
} | ||
|
||
public Issue19379CustomHeader CustomHeader | ||
{ | ||
get { return _customHeader; } | ||
set | ||
{ | ||
_customHeader = value; | ||
OnPropertyChanged(); | ||
} | ||
} | ||
} | ||
|
||
public class Issue19379CustomHeader | ||
{ | ||
public string Title { get; set; } | ||
} | ||
} |
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
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
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
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
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
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
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
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,29 @@ | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.AppiumTests.Issues | ||
{ | ||
public class Issue19379 : _IssuesUITest | ||
{ | ||
public Issue19379(TestDevice device) | ||
: base(device) | ||
{ } | ||
|
||
public override string Issue => "Not able to update CollectionView header"; | ||
|
||
[Test] | ||
public void UpdateCollectionViewHeaderTest() | ||
{ | ||
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows }); | ||
|
||
App.WaitForElement("WaitForStubControl"); | ||
|
||
// 1. Update the CollectionView Header. | ||
App.Click("UpdateButton"); | ||
|
||
// 2. Verify the result. | ||
VerifyScreenshot(); | ||
} | ||
} | ||
} |
Binary file added
BIN
+61.4 KB
src/Controls/tests/UITests/snapshots/ios/UpdateCollectionViewHeaderTest.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.