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.

Cascading sample using SfPicker in Xamarin Forms

In our Xamarin Forms, SfPicker control has Multi column support based on collection. So we can add or remove the collection based on our requirements. Using this we can populate Country and States of the respective Country in a collection using SfPicker control.

We have demonstrated how to create custom Cascading sample using Picker control in the following steps.

We have created the cascading sample for updating state collection based on SelectedItem of SfPicker.

Please refer the below steps to create the cascading sample

Step 1: We have created three ObservableCollection with object type in PickerCascading class.

Collection details:

Area Collection, Country Collection and State Collection.

Country Collection -> We have added country names.

State Collection -> We have added state names.

Area Collection -> We have added above 2 collections.

Area Collection is main collection we have assigned this collection to ItemsSource of Picker Control.

The below code demonstrates Area collection creation.

C#

 

Step 2: We have updated the state collection based on selected item of country name using Selection changed event of SfPicker control.

C#

 

Step 3: We have defined column headers as “Country” and State” using ColumnHeaderText property of SfPicker control. The below code demonstrates how to define header for each column of SfPicker control.

C#

 

Step 4: We have added the cascading picker control in main XAML page. Please refer the below code snippets.

XAML

 

 

C#

 

Please find the below screen shot using the above codes.

        

 

We have attached Cascading sample for your reference. Please download the sample from the following link.

 

Sample link: CascadingSample

Article ID: Published Date: Last Revised Date: Platform: Control:
7983 09/13/2017 09/13/2017 Xamarin.Forms SfPicker
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.