-
-
Save darthdeus/af0f11b0e5c306bfc134 to your computer and use it in GitHub Desktop.
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
using System; | |
using Xamarin.Forms; | |
using System.Collections.ObjectModel; | |
using System.Threading.Tasks; | |
namespace ListViewLayoutBug | |
{ | |
public class TestPage : ContentPage | |
{ | |
public TestPage() | |
{ | |
var source = new ObservableCollection<string>(); | |
var list = new ListView | |
{ | |
// Comment this line out to observe the bug. It's just here to show that the asynchronous | |
// loading itself works. | |
HeightRequest = 80, | |
ItemsSource = source | |
}; | |
LoadItems(source); | |
var layout = new AbsoluteLayout(); | |
layout.Children.Add(list); | |
Content = layout; | |
} | |
async void LoadItems(ObservableCollection<string> items) | |
{ | |
// If you comment the delay out, the function will run synchronously and the content will appear. | |
await Task.Delay(2000); | |
items.Add("hello"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment