Get the checked items of a CheckListBox
Hi,
How can I get the items that are checked in my CheckListBox, I tried SeletecItem property, connected with a List <>, but had no success.
ps. I'm using MVVM.
thanks
SIGN IN To post a reply.
7 Replies
MA
Muthukumar A
Syncfusion Team
October 5, 2015 07:29 AM UTC
Hi Fabio,
Thanks for contacting Syncfusion Support.
Since CheckListBox has been inherited from MultiSelector, its SelectedItems Property is Hidden and ReadOnly. So using the SelectedItems in MVVM is not possible.
But we can achieve your requirement by two ways,
First way:
Include bool property, say "IsSelected" in Model level and bind this property with IsSelected of CheckListBoxItem. This can be done by modifying the ItemsContainerStyle of Control. And then while the property changes, write your codes to preserve SelectedItems.
Second Way: Including either AttachedProperty or Behavior
Here we need to provide new attached property to hold the selected items of control. Unlike previous way, this will support full XAMl binding in MVVM.
We have created a demo sample that tries to explain above methods. You can download the sample from the below location.
Sample:
CheckedListBox_Sample
Please let us know if the sample helps or in case of any other query.
Regards,
Muthukumar A
Thanks for contacting Syncfusion Support.
Since CheckListBox has been inherited from MultiSelector, its SelectedItems Property is Hidden and ReadOnly. So using the SelectedItems in MVVM is not possible.
But we can achieve your requirement by two ways,
First way:
Include bool property, say "IsSelected" in Model level and bind this property with IsSelected of CheckListBoxItem. This can be done by modifying the ItemsContainerStyle of Control. And then while the property changes, write your codes to preserve SelectedItems.
Second Way: Including either AttachedProperty or Behavior
Here we need to provide new attached property to hold the selected items of control. Unlike previous way, this will support full XAMl binding in MVVM.
We have created a demo sample that tries to explain above methods. You can download the sample from the below location.
Sample:
CheckedListBox_Sample
Please let us know if the sample helps or in case of any other query.
Regards,
Muthukumar A
FH
Fabio Henrique Baptista
October 5, 2015 10:51 PM UTC
Hi,
Thank you, it worked perfectly.
Fabio
MA
Muthukumar A
Syncfusion Team
October 6, 2015 04:47 AM UTC
Hi Fabio,
We are glad to hear that your requirement is fulfilled.
Please let us know if you need any further assistance on this.
Regards,
Muthukumar A
We are glad to hear that your requirement is fulfilled.
Please let us know if you need any further assistance on this.
Regards,
Muthukumar A
AP
Andy Pybus
June 11, 2017 07:17 PM UTC
Dear Muthukumar,
I want to use the CheckListBox control in a simple dialog window.
I am not using MVVM.
I require that only a single item can be selected.
Can you recommend a way to do this?
Regards,
Andy Pybus
KJ
Keerthana Jegannathan
Syncfusion Team
June 12, 2017 08:49 AM UTC
Hi Andy,
Thanks for your update.
We suspect that your requirement is to check only one item from CheckListBox control at a time, if so we have prepared a workaround sample to meet your requirement in which we have changed the “IsSelected” property of the previously checked item to false once new item has been checked in SelectionChanged event of the CheckListBox control and it can be downloaded from the below location.
Sample: CheckListBox_Sample
Regards,
Keerthana J
NA
naveen
February 16, 2018 06:15 AM UTC
i need xamarin pdf
SL
Sowmiya Loganathan
Syncfusion Team
February 19, 2018 11:17 AM UTC
Hi Fabio,
Could you please provide more information about what feature you need from Xamarin PDF. It would be helpful for us to provide a precise solution.
For more information about PDF, please refer the below UG documentation link:
Please refer the below PDF Feature Tool link for your reference:
Please let us know if you need further assistance on this.
Regards,
Sowmiya L
SIGN IN To post a reply.
- 7 Replies
- 6 Participants
-
FH Fabio Henrique Baptista
- Oct 4, 2015 01:02 PM UTC
- Feb 19, 2018 11:17 AM UTC