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



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

1 Reply

PA Paul Anderson S Syncfusion Team 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 

Live Chat Icon For mobile
Up arrow icon