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

Set selected items from list or object from ViewModel

I'm looking at the sample application in"Syncfusion\EssentialStudio\13.3.0.7\WPF\Tools.WPF\Samples\ComboBox\ComboBox\CS".

How do I set the selected items in ViewModel  to UK an CA on startup for example?

I will be loading the selected items from a database in the future so I need to understand how to load and save selected items.



3 Replies

SM Sugapriya Mariappan Syncfusion Team November 17, 2015 11:37 AM UTC

Hi Peter,

Thank you for contacting Syncfusion Support

“Query #1: How do I set the selected items in ViewModel to UK and CA on startup for example?”

We have prepared a sample which tries to meet your requirement .In this sample, we have bound the first two items from the ObservableCollection to the SelectedItems collections property.

Please download the sample from the below link
Sample link:ComboBoxadvSample

“Query #2: how to load and save selected items.

We have bound the Checked ListBox SelectedItems to the ComboBoxAdv’s SelectedItems collection property in the button click event via command binding to achieve your requirement.

Please find the sample attached in the following link.
Sample: ComboboxAdvSaveSample

Regards,
M.Sugapriya


PV Peter Viau November 18, 2015 02:45 PM UTC

Thank you for your quick reply!
I was able to combine both your samples to get what I needed except for one little enhancement I'd like to have.

Is it possible to add a checkbox called "All Users" that acts like  a toggle so that if "All Users" is checked all  the others get checked, and if "All Users" is unchecked then all get unchecked?
I think it would also get unchecked if the user selects another entry while it is checked.


SM Sugapriya Mariappan Syncfusion Team November 19, 2015 09:46 AM UTC

Hi Peter,

We would like to inform you that we don’t have this support “Select and unselect all the items in ComboBoxAdv” currently and so have logged feature report regarding this. A support incident to track the status of this feature has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let us know if you have any questions.

Regards,
M.Sugapriya

Loader.
Up arrow icon