This is a migrated thread and some comments may be shown as answers.

How to set CheckedItems in Windows

3 Answers 49 Views
Window
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Miroslav
Top achievements
Rank 1
Miroslav asked on 11 Jun 2012, 03:18 PM
Hello,

I have a DataBoundListBox inside Window. After opening Window I need set CheckedItems in DataBoundListBox, but DataBoundListBox have no values. I tried it in event "WindowOpened". But in real I see all items in ListBox. How can I set CheckedItems so that it was after data binding?
Same issue is in PickerBox...

Thanks

Miroslav Mareš

3 Answers, 1 is accepted

Sort by
0
Lancelot
Top achievements
Rank 1
answered on 11 Jun 2012, 09:39 PM
Hi Miroslav,

It seems you are looking trying too early to set the checkbox's state, there isn't anything loaded in the listbox yet. Try to use the Loaded event for the RadDataBoundListBox instead. The same goes for the RadListPicker. Here is an example:

<telerik:RadDataBoundListBox x:Name="myRadListBox" Loaded="myRadListBox_Loaded" >
   <your dataTemplate with checkbox and other goodies in here />
</ telerik:RadDataBoundListBox>

Use the control's loaded event instead of the window's loaded event. This way you should have access to the items in the listbox.

Good Luck,
Lancelot
0
Deyan
Telerik team
answered on 12 Jun 2012, 07:43 AM
Hello Miroslav,

 Thanks for writing.

Changing the checked/unchecked state of items in DataBoundListBox is done by modifying the contents of the CheckedItems collection. It is important to note that this collection is working only after you have bound the control to a data source so make sure that you do this in this sequence.

I hope this helps.

Kind regards,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Miroslav
Top achievements
Rank 1
answered on 12 Jun 2012, 08:13 AM

Hi Lancelot,

this is, what I need.

thanks

Miroslav Mareš

Tags
Window
Asked by
Miroslav
Top achievements
Rank 1
Answers by
Lancelot
Top achievements
Rank 1
Deyan
Telerik team
Miroslav
Top achievements
Rank 1
Share this question
or