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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

read a SfPicker on iOS

Thread ID:

Created:

Updated:

Platform:

Replies:

132587 Sep 11,2017 03:57 AM Sep 12,2017 09:39 AM Xamarin.Forms 3
loading
Tags: SfPicker
FLecointe
Asked On September 11, 2017 03:57 AM

Hi!
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.

FLecointe
Replied On September 12, 2017 04:20 AM

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


FLecointe
Replied On September 12, 2017 08:27 AM

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 09:39 AM

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
 
  
Scenario:

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

Regards,

Eswaran AT.   


CONFIRMATION

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.

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

;