views:

473

answers:

2

I'm working in Silverlight. I've got a ListBox that's being loaded dynamically. In the listbox, i want to put a checkbox that's tied to the listbox's "selected" property. I can't quite figure out how this is done. Can anyone point me in the right direction? If this were a winform thing, I would, create "OnChecked" handler for the checkbox to find the parent of the checkbox and set it to selected. I'm working on the notion that there is a better way. Thanks.

A: 

Nope.

In WPF you could do it by putting something the following on your CheckBox:

Checked="{Binding Source=Listbox.SelectedItem, Path=Something, Converter={StaticResource SomeConverter}}"

But, sadly, Silverlight 2 does not support binding to other controls using Source=.

In other words, there is no better way at this point in time. Code is all you've got.

Cory R. King
+3  A: 

Silverlight 2 does not offer support for what they call Element to Element Binding.

This feature has been added to Silverlight 3 which is currently in Beta. Silverlight 3 is available at http://silverlight.net/getstarted/silverlight3/default.aspx

bendewey