We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

read a SfPicker on iOS

Thread ID:





132587 Sep 11,2017 07:57 AM UTC Sep 12,2017 01:39 PM UTC Xamarin.Forms 3
Tags: SfPicker
Asked On September 11, 2017 07:57 AM UTC

I have a little worry I have seen late.
I start and I think to check what I code on Android, but I will probably go too fast for iOS, so I took a little time before I picked up the error:
my SfPicker works well on iOS (although I will have to change the default selection, but that's another story), but when I want to read the selected item, it's a mistake.

Note that this problem does not appear on Android.

Replied On September 12, 2017 08:20 AM UTC

I forgot to specify: in exception, this tells me "Object reference not defined at the instance of an object"

Replied On September 12, 2017 12:27 PM UTC

Well, I ended up finding how to reset the SelectedItem of the picker:
first of all I make sure of the position of the picker:

PickerMoment.SelectedIndex = 0;

Now that I know the value displayed, I manually initialize the selectedItem (which is rather unusual). As I know the initial value this is not a problem.

PickerMoment.SelectedItem = "Indifferent";

what is surprising is that Android has no initialization concerns, it can directly read the selected item, for iOS the selected item is only initialized if its value changes during use ( in other words, by default the selected item does not initialize, but if you swipe on the next or previous iOS initializes the item)

Eswaran Thirugnanasambandam [Syncfusion]
Replied On September 12, 2017 01:39 PM UTC

Hi Flecointe,

Thanks for contacting Syncfusion Support.

We have prepared a sample in which we have used the OkButtonClicked event to display the selected item in the alert dialog box. We are facing an issue while we tried to get the default selected item from the SfPicker when clicking the ok button without altering the picker values. Please check whether this is issue which you are facing from your side. And please find the sample in the below link.

Link: http://www.syncfusion.com/downloads/support/forum/132587/ze/PickerSample1-1834601586

Click the button
In the SfPicker, without changing the selected item. Click “ok”.


Eswaran AT.   


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon