title: How to make a UserControl remove itself at runtime (in WPF)?
body: <p>I have made a <code>userControl</code> consisting a few labels and checkboxes and an "x" button for removing itself when clicked.</p>
  
  <p>Considering that in my WPF application, the user can dynamically put as many of this <code>userControl</code> at runtime as he wants, <strong>AND</strong> that none of them will have a <code>name</code> attribute to address to, how exactly is it possible to remove a <code>UserControl</code> from the application, by clicking on it's -child- button "x" (i.e. inside the event handler of it's "x" button)  ???</p>
  
  <hr>
  
  <p>I've already looked a thousand places and found these particular two lines of code which <strong>DID'NT WORK</strong> :</p>
  
  <pre><code>((Grid)button.Parent).Children.Remove(this);
  ((Button)control.Parent).Content = null;
  </code></pre>