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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





141083 Nov 22,2018 04:42 PM UTC Nov 23,2018 09:52 AM UTC Xamarin.Forms 1
Tags: SfPicker
Giovanni Zangrossi
Asked On November 22, 2018 04:42 PM UTC


I have a picker (pickermode: dialog), and I'm binding ItemsSource and SelectedItemIndex to properties in my ViewModel class:

                <Label Text="{Binding Path=Automezzo}">
                        <TapGestureRecognizer Command="{Binding Path=ShowAutomezzoPickerCommand}" />

                <sf_picker:SfPicker ItemsSource="{Binding Path=Automezzi}"
                                    SelectedIndex="{Binding Path=AutomezzoIndex, Mode=TwoWay}"
                                    HeaderText="Selezione Automezzo"
                                    IsOpen="{Binding Path=ShowAutomezzoPicker}" />

When I change the picker selection, the property AutomezzoIndex is changed, and the view loads new data. But I need to change AutomezzoIndex only when the picker is closed... how can I do that?

Thank you

Paul Anderson S [Syncfusion]
Replied On November 23, 2018 09:52 AM UTC

Hi Giovanni Zangrossi, 
Greetings from Syncfusion. 
Query: Need to change the SelectedIndex only when the picker is closed. 
We analysed your query and currently the SelectedItem and the SelectedIndex will get changed on changing the selection in the picker itself. So, we have work-arounded to meet your requirement by using the custom picker. 
We have prepared a sample by using a custom picker. In the sample, we have created a “PickerSelectedIndex” property in the custom picker class and we have used this property to store the current selected index value while closing the picker in the “Closed” event. For your use, you can use the "PickerSelectedIndex" property instead of “SelectedIndex” property in your sample to achieve your requirement. Please find the sample from the below link. 
Please check our sample and let us know if you have any concerns. 
Paul Anderson 


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

Live Chat Icon For mobile
Live Chat Icon