title: WPF - How does Parent know of on "Checked" event for child control checkbox?
body: <p>I have a child control that has a checkbox and webbrowser:</p>
  
  <pre><code>&lt;UserControl x:Class="Some.MyUserControl" etc.&gt;
    &lt;Grid&gt;
      &lt;CheckBox x:Name="chkA" Content="Analysis" Checked="chkA_Checked"&gt;&lt;/CheckBox&gt;
      &lt;WebBrowser Margin="0,30,0,0" Name="wbA"&gt;&lt;/WebBrowser&gt;
    &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>I am putting this control in my MainWindow.xaml/.cs:</p>
  
  <pre><code>&lt;Window x:Class Some.MainWindow xmlns:local="clr-namespace:Some" etc.&gt;
    &lt;Grid&gt;
      &lt;local:MyUserControl x:Name="MyUserControl_Main"&gt;&lt;/local:MyUserControl&gt;
    &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>My question is how can my MainWindow know that the CheckBox (chkA) has been checked?  So far only the actual user control knows it has been clicked?  How can I expose the "Checked" event for my MainWindow to see?  Or is there a better way?</p>
  
  <p>I've searched the web, but can't seem to wrap my head around what I'm seeing.</p>
  
  <p>Thank you in advance,</p>
  
  <p>-newb</p>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>I am trying the following with no luck, but may be on the right track.</p>
  
  <p>Within my MainWindow.xaml.cs I have added:</p>
  
  <pre><code>public static readonly RoutedEvent CheckedEvent = EventManager.RegisterRoutedEvent("Checked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyUserControl));
  
  public event RoutedEventHandler Checked
  {
      add { AddHandler(CheckedEvent, value); }
      remove { RemoveHandler(CheckedEvent, value); }
  }
  </code></pre>
  
  <p>And within MyUserControl.xaml.cs I have added:</p>
  
  <pre><code>private void chkA_Checked(object sender, RoutedEventArgs e)
  {
      RoutedEventArgs args = new RoutedEventArgs(MainWindow.CheckedEvent);
      RaiseEvent(args);
  }
  </code></pre>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Moved previously mentioned code into MyUserControl.xaml.cs:</p>
  
  <pre><code>public static readonly RoutedEvent CheckedEvent = EventManager.RegisterRoutedEvent("Checked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyUserControl));
  
  public event RoutedEventHandler Checked
  {
      add { AddHandler(CheckedEvent, value); }
      remove { RemoveHandler(CheckedEvent, value); }
  }
  
  private void chkA_Checked(object sender, RoutedEventArgs e)
  {
      RoutedEventArgs args = new RoutedEventArgs(MainWindow.CheckedEvent);
      RaiseEvent(args);
  }
  </code></pre>
  
  <p>And now I am able to see the "Checked" event "Bubble" up as so:</p>
  
  <pre><code>&lt;Window x:Class Some.MainWindow xmlns:local="clr-namespace:Some" etc.&gt;   
    &lt;Grid&gt;     
      &lt;local:MyUserControl x:Name="MyUserControl_Main" **Checked="MyUserControl_Main_Checked"**&gt;&lt;/local:MyUserControl&gt;   
    &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>Thanks @Matt for the tip!</p>
  
  <p><strong>EDIT 3:</strong></p>
  
  <p>Matt's first answer is the best way to go, I had it "Checkbox" vs "CheckBox"... Adding CheckBox.Checked to the grid catches the event:
      </p>