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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

MVVM And CheckListBox

Thread ID:

Created:

Updated:

Platform:

Replies:

123379 Mar 11,2016 02:18 PM UTC Mar 14,2016 11:16 AM UTC WPF 1
loading
Tags: CheckListBox
James Randle
Asked On March 11, 2016 02:18 PM UTC

Hi,
I have followed the sample from the following post ...

http://www.syncfusion.com/forums/120688/Get-the-checked-items-of-a-CheckListBox

but I cannot find a way to add a SelectedItem in code and have the associated checkbox ticked as a result.

I added a button to the main window, with the following click event:

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ClassViewModel cvm = (ClassViewModel)DataContext;
            cvm.SelectedStudents.Add(cvm.Students[3]);
        }

When i click the button, the item gets added to the listbox as expected, BUT THE RESPECTIVE CHECKBOX REMAINS UNTICKED. Which is the problem!!

Please can you help? :0)

I have attached the project I am working with.

Attachment: CheckedListBox_Sample_1d74edd7.rar

Vijayalakshmi Roopkumar [Syncfusion]
Replied On March 14, 2016 11:16 AM UTC

Hi James,

Thank you for using Syncfusion products,

We have modified the sample that tries to meet your requirement. In this sample, we have added the new items by setting its IsSelected property as true in the button click, so that the items gets added in the listbox and also respective checkbox gets checked. Please download the sample from the following location:

Sample:CheckedListBox_Sample

Regards,
Vijayalakshmi V.R.

CONFIRMATION

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.

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

;