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

Selection

Hallo,

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

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

                <sf_picker:SfPicker ItemsSource="{Binding Path=Automezzi}"
                                    SelectedIndex="{Binding Path=AutomezzoIndex, Mode=TwoWay}"
                                    HeaderText="Selezione Automezzo"
                                    PickerMode="Dialog"
                                    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. 
 
Regards, 
Paul Anderson 
 


Loader.
Up arrow icon