Description
I have a Picker that is attached to an enum for a "list type" property, with a "SelectedIndex=0" attribute on the picker, which I believe means that I want that index of the enum to be selected first, as a 'default'. This works great on the windows app, but when running on Android, the picker control is empty. Then, I'm able to force something into the control by manually changing the "selected index" in the .xaml from say, 0 to 1, which I think then triggers the event, and updates in the app. But obviously since I think the point of SelectedIndex is to default something in, then, well, it should default something in.
I found a workaround for this by grabbing the picker control in the constructor in the code-behind for the page, and setting it's SelectedIndex property there, which fixes it. But I presume that the xaml property should work without needing to do that.
Here is the repo for the demo app i'm playing with -
Xaml for the view with the Picker - https://github.com/Programming-With-Chris/ShoppingList/blob/master/ShoppingList/View/UserListDataInput.xaml
Code Behind showing the 'work around' - https://github.com/Programming-With-Chris/ShoppingList/blob/master/ShoppingList/View/UserListDataInput.xaml.cs
Steps to Reproduce
- Use Picker Control in a ContentPage
- Set the "SelectedIndex="0"" value on the Picker
- See that on that page loading, nothing is populated on Android, but is on the Windows App
Version with bug
6.0.408 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
'android'">21.0
Did you find any workaround?
Yes, as described above - "I found a workaround for this by grabbing the picker control in the constructor in the code-behind for the page, and setting it's SelectedIndex property there, which fixes it. "
Relevant log output
No response
Description
I have a Picker that is attached to an enum for a "list type" property, with a "SelectedIndex=0" attribute on the picker, which I believe means that I want that index of the enum to be selected first, as a 'default'. This works great on the windows app, but when running on Android, the picker control is empty. Then, I'm able to force something into the control by manually changing the "selected index" in the .xaml from say, 0 to 1, which I think then triggers the event, and updates in the app. But obviously since I think the point of SelectedIndex is to default something in, then, well, it should default something in.
I found a workaround for this by grabbing the picker control in the constructor in the code-behind for the page, and setting it's SelectedIndex property there, which fixes it. But I presume that the xaml property should work without needing to do that.
Here is the repo for the demo app i'm playing with -
Xaml for the view with the Picker - https://github.com/Programming-With-Chris/ShoppingList/blob/master/ShoppingList/View/UserListDataInput.xaml
Code Behind showing the 'work around' - https://github.com/Programming-With-Chris/ShoppingList/blob/master/ShoppingList/View/UserListDataInput.xaml.cs
Steps to Reproduce
Version with bug
6.0.408 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
'android'">21.0
Did you find any workaround?
Yes, as described above - "I found a workaround for this by grabbing the picker control in the constructor in the code-behind for the page, and setting it's SelectedIndex property there, which fixes it. "
Relevant log output
No response