Bug 26958 - Picker not displaying initial selection.
Summary: Picker not displaying initial selection.
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.3
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-02-11 13:03 UTC by laygr
Modified: 2015-02-13 08:32 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description laygr 2015-02-11 13:03:33 UTC
Picker not displaying initial selection.
Happens either when I set the initial value in xaml or in code.

Given this Xamarin.Forms Sketch:

using Xamarin.Forms;

	new ContentPage {
		Padding = new Thickness (0, 20, 0, 0),
		Content = new StackLayout{
			Children = {
				new Picker{
					Items = {"0", "1", "2"}

I would expect that the initial displaying for the picker would be: "1"; however, it is blank.
Only until I change the selection, the display updates.
Comment 2 Jason Smith [MSFT] 2015-02-13 08:32:39 UTC
You must set the SelectedIndex after you set the items. The index will clamp to the number of items. We are considering moving this restriction but it means you would be able to essentially send weird/unresolvable situations where the SelectedIndex does not correspond to any element. This is not a bug, but a behavior change is being considered