C# .NET - Listbox with checkbox in silverlight.while selecting checkbox the selected item wont fire

Asked By Sankar Manoharan on 21-Jun-12 07:46 AM
Earn up to 20 extra points for answering this tough question.
 I have a List box with checkbox in silver light control.while selecting checkbox the selected item of list box is nor fire. how to fire it?
[)ia6l0 iii replied to Sankar Manoharan on 21-Jun-12 10:17 PM
I hope you have associated checked and unchecked events in your XAML as it is shown below.

<ListBox Name="ListboxName">
       <ListBox.ItemTemplate>
            <DataTemplate>
                      <CheckBox IsChecked="{Binding SomeBoolProperty}" ClickMode="Press"
Checked="CheckBox_Checked" 
Unchecked="CheckBox_UnChecked" />                                                                                   
            </DataTemplate>
       </ListBox.ItemTemplate>
  </ListBox>


And in your code class, I hope you have added the Checked and UnChecked event handlers. 
Checked Event handler.

private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
         CheckBox cb = (CheckBox)sender;
}

UnChecked Event handler.
 
private void CheckBox_UnChecked(object sender, RoutedEventArgs e)
{
         CheckBox cb = (CheckBox)sender;
}


Hope this helps.