Bug 51642 - [UWP] Picker doesnt show items in - works in
Summary: [UWP] Picker doesnt show items in - works in
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows (show other bugs)
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
: 51502 (view as bug list)
Depends on:
Reported: 2017-01-19 18:41 UTC by spoiltnr1
Modified: 2017-03-10 17:07 UTC (History)
8 users (show)

See Also:
Tags: AC
Is this bug a regression?: ---
Last known good build:

Bug 51642 - UWP Picker - deferred BindingContext initialization error (104.53 KB, application/x-zip-compressed)
2017-01-19 23:02 UTC, spoiltnr1

Description spoiltnr1 2017-01-19 18:41:16 UTC
If a Picker is bound with ItemsSource, no elements are displayed when clicking the picker-control. It seems the native control doesn't get the items to display.

In it works as expected.


<Picker Title="Foo" ItemsSource="{Binding AnObservalbeStringCollection}"></Picker>

Doesn't work, but

<Picker Title="Foo">

Comment 1 David Ortinau [MSFT] 2017-01-19 19:08:48 UTC
I'm not able to repro a problem with the example. My UWP project is working.

Did you implement a ToString? 

Please post a sample project or at least more context about AnObservableStringCollection.
Comment 2 spoiltnr1 2017-01-19 23:02:42 UTC
Created attachment 19408 [details]
Bug 51642 - UWP Picker - deferred BindingContext initialization error

I just found out that the error only occurs, if the BindingContext initialization is delayed some time (i.e. 1000ms) after the construction of the page.

In the sample project I attach, there is a bool-switch called "delayed" in the constructor of MainPage. Run it one time with false (all picker work), then with true (the second picker using ItemsSource doesnt work anymore).
Comment 3 David Ortinau [MSFT] 2017-01-20 17:24:08 UTC
I was able to confirm the delayed binding isn't updating bound picker.
Comment 4 Stephane Delcroix 2017-01-23 15:30:00 UTC
UWP picker never supported collection changed it seems
Comment 5 Stephane Delcroix 2017-01-27 09:27:25 UTC
see https://github.com/xamarin/Xamarin.Forms/pull/725
Comment 6 Samantha Houts [MSFT] 2017-02-15 18:56:38 UTC
*** Bug 51502 has been marked as a duplicate of this bug. ***
Comment 7 Samantha Houts [MSFT] 2017-02-23 18:37:35 UTC
Should be fixed in 2.3.4-pre3. Thank you!
Comment 8 Christian Schwarz 2017-03-10 10:25:27 UTC
It still doesn't work with the following code:

public class MainViewModel
	public ObservableCollection<string> Items { get; set; }

	public MainViewModel()
		Items = new ObservableCollection<string>();

		Task.Delay(1000).ContinueWith(t =>
			Device.BeginInvokeOnMainThread(() =>
				Items.Add("Item 1");
				Items.Add("Item 2");
				Items.Add("Item 3");

public partial class MainPage : ContentPage
	public MainPage()

		BindingContext = new MainViewModel();
Comment 9 spoiltnr1 2017-03-10 13:23:20 UTC
I confirm, modifiying an (ObservableCollection) ItemsSource doesn't trigger an update to the picker. Even setting ItemsSource to null and to a new value (inkl. OnPropertyChanged) doesn't trigger an update.

If in the previous sample Items was initialized with an collection like new[]{"Item 0"} only "Item 0" gets displayed.
Comment 10 spoiltnr1 2017-03-10 14:51:18 UTC
Seems like a *wrong dll* was packaged in the nuget-package (checked with dotpeek)!
Comment 11 Rui Marinho 2017-03-10 15:17:24 UTC
Sorry , should be on 2.3.4-pre4
Comment 12 Christian Schwarz 2017-03-10 17:07:04 UTC
Works fine with 2.3.4-pre4, thank you for the fast response.

Note You need to log in before you can comment on or make changes to this bug.