title: ListBox and finding the selected checkbox
body: <p>I am currently working on a C# wpf project. I have a listbox and I am dynamically adding checkboxes to the listbox with the following code.</p>
  
  <pre><code>while (reader.Read())
  {
       Console.WriteLine("Database: " + reader.GetString("Database"));
       string databaseName = reader.GetString("Database");
       CheckBox chkDatabase = new CheckBox();
       chkDatabase.Content = databaseName.Replace("_", "__");
       chkDatabase.Uid = "chk_" + reader.GetString("Database");
       chkDatabase.Checked += new RoutedEventHandler(chkDatabase_Checked);
  
       lstDatabase.Items.Add(chkDatabase);
  }
  </code></pre>
  
  <p>This is working fine and I the routedeventhandler works fine to determine when a check box has been selected or not. </p>
  
  <p>What I want to be able to do is to allow the user to click on the row that the checkbox is in, instead of actually checking the row. I've added an event handler to the list box for the selection changed like the following:</p>
  
  <pre><code>private void lstDatabase_SelectionChanged(object sender, SelectionChangedEventArgs e)
  {
      Console.WriteLine("Selection Changed");
      ListBox checkbox = (ListBox)e.Source;
      Console.WriteLine("Checkbox2: " + checkbox.SelectedValue);
  }
  </code></pre>
  
  <p>How can I get the checkbox value from the selection changed event handler. </p>
  
  <p>Thanks for any help you can provide. </p>