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

How to load the picker editor ItemsSource asynchronously in Xamarin DataForm ?

Platform: Xamarin.Forms |
Control: SfDataForm |
Published Date: November 14, 2018 |
Last Revised Date: November 14, 2018

DataForm picker editor will be loaded for the enum property type, by default. You can also load list or complex type by using the GetSource override method of SourceProvider class and set it to SourceProvider property of data form which is used to set the ItemsSource of picker editor.

 

It is not possible to directly use async/await method for setting the ItemsSource of picker editor other than enum type, since the return type of GetSource override method is not supported as asynchronous method. Instead, it is possible to return a list of items included in the asynchronous method using the GetSource override method.

 

 Here, the CityName property is used as picker editor.

 

 

In the AutoGeneratingDataFormItem event, you need to set the  DisplayMemberPath and ValueMemberPath  property values when DataFormPickerItem is complex type property.

 

 

Refer to the following code to load the picker ItemsSouce asynchronously using the SourceProvider class.

 

 

Refer to the following code example for binding the DataObject and registering property using the RegisterEditor method as picker in DataForm.

 

 

Note: Picker editor is not supported in Xamarin.Forms.UWP platform.

 

You can refer to the DataForm user guide documentation to know more about picker:

https://help.syncfusion.com/xamarin/sfdataform/editors#picker-editor

 

To download the sample click PickerItemsOnAsyncLoad

 

 

 

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon