0

I've got a ListBox, within it I have a custom DataTemplate that builds a button. Each button represents a selection the user can perform.

When the button is clicked, is there anyway I can retrieve the original data record for that bound item? In standard C#, I can create a button and use CommandArgument to pass an ID to an event. Is there something similar in Silverlight?

Thanks

bugfixr
  • 7,997
  • 18
  • 91
  • 144

1 Answers1

2
private void RemoveMember_Click(object sender, RoutedEventArgs e)
{
    var employee = ((Button)sender).DataContext as Employee;
    if(employee == null)
        return;
    _employeeList.Items.Remove(employee);
}