Set item bound to SelectItem only when OK button is clicked.

Hello,

I have the ItemsSource bound to a collection with the selected item bound to an object as follows:

SelectedItem="{Binding SelectedUnit}" ItemsSource="{Binding AllUnits}

As the user scrolls through the list in the picker, the picker sets the SelectedItem to each item that gets highlighted.  The problem I'm facing is that I have actions performed when the SelectedItem is set and I only want those actions performed when the OK button is clicked rather than when the item is highlighted in the picker control.  Is this a way to only have the SelectedItem set when the OK button is clicked?

Thanks,
Scott


3 Replies

SS Suganya Sethuraman Syncfusion Team January 24, 2022 12:14 PM UTC

Hi Scott,

We do not have direct support to achieve your requirement. We have created custom picker and provided CustomSelectedItem property to that class. We set the CustomSelectedItem when we clicked the OK button in SfPicker as shown in the below code snippet,

Code snippet
 
        private void picker_OkButtonClicked(object sender, Syncfusion.SfPicker.XForms.SelectionChangedEventArgs e) 
        { 
            picker.CustomSelectedItem = e.NewValue; 
        } 

Please have a sample for your reference,

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SfPicker_Ok-268035589

Please check and let us know if you have any concerns.

Regards,
Suganya Sethuraman.
 



SR Scott Roberts January 31, 2022 08:07 PM UTC

Hi Suganya,

That control meets our needs.  Thank you very much!

Scott



SS Suganya Sethuraman Syncfusion Team February 1, 2022 07:22 AM UTC

Hi Scott,

Thanks for the update.

We are glad that your issue is resolved. Please let us know if you require any further assistance.

Regards,
Suganya Sethuraman.
 


Loader.
Up arrow icon