I have a Listbox, that has a Checkbox as part of the item template.
In the click even of the Checkbox, I want to make sure that same list item is selected.
ListBoxItem lbi = ((ListBoxItem)listLayers.
ContainerFromElement((CheckBox)sender));
lbi.IsSelected = true;
The main issue that I'm having is that "ContainerFromElement" is not available in silverlight.
Any help is greatly appreciated.
edit
This is the code I'm running in the click event of a checkbox inside my list:
MyObject obj = listLayers.SelectedItem as MyObject;
obj.Visible = true;
obj.Value = "50";
Using the RelativeSource binding on the checkboxes along with this code, I end up with obj equal to null.
I have a list of layers that I want to turn on and off via checkboxes, I'm open to another way...