Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Clear selected value from a Picker?

$
0
0

How can I clear the value from a Picker once selected (I'm assuming that this isn't possible through the standard UI as I haven't found a way to do it, so I'm trying to do it programatically).

I'm trying to add a "[clear]" item as the first item in the items collection. Then in the SelectedIndexChanged event handler, I check to see if SelectedIndex == 0. If so, I set the selected index to -1. I've verified that the index is in fact being set to -1, but the Picker continues to display the formerly selected option.

If I create a button, I can set the Picker's SelectedIndex to -1 and it works as expected (the Picker displays the Title as though a selection hasn't been made).

Appreciate any advice.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>