This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invalidate CollectionView Layout on transition to IsVisible = true (#…
…13370) fixes #13203 * Automated test * Tell CollectionView Layout to invalidate if IsVisible transitions to true; fixes #13203 * Remove old waitforelement call * Unsubscribe property changed handler during Dispose
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue13203.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,59 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Text; | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Issue(IssueTracker.Github, 13203, "[Bug] [iOS] CollectionView does not bind to items if `IsVisible=False`", PlatformAffected.iOS)] | ||
#if UITEST | ||
[NUnit.Framework.Category(UITestCategories.CollectionView)] | ||
#endif | ||
public class Issue13203 : TestContentPage | ||
{ | ||
const string Success = "Success"; | ||
|
||
protected override void Init() | ||
{ | ||
var cv = new CollectionView | ||
{ | ||
IsVisible = false, | ||
|
||
ItemTemplate = new DataTemplate(() => | ||
{ | ||
var label = new Label(); | ||
label.SetBinding(Label.TextProperty, new Binding(nameof(Item.Text))); | ||
return label; | ||
}) | ||
}; | ||
|
||
var source = new List<Item> { new Item { Text = Success } }; | ||
cv.ItemsSource = source; | ||
Content = cv; | ||
|
||
Appearing += (sender, args) => { cv.IsVisible = true; }; | ||
} | ||
|
||
class Item | ||
{ | ||
public string Text { get; set; } | ||
} | ||
|
||
#if UITEST | ||
[Test] | ||
public void SettingGroupedCollectionViewItemSourceNullShouldNotCrash() | ||
{ | ||
RunningApp.WaitForElement(Success); | ||
} | ||
#endif | ||
} | ||
} | ||
|
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