title: MVVM stuck event hook
body: <p>I'll start by saying this is a very simplified example, my problem is in a much larger project so while a restructure of what I'm doing would be the best way it's not an option, I'm looking for something I can add to this example to solve the issue at the bottom if possible.</p>
  
  <p>I have 2 <code>viewmodels</code>(<code>Person</code> and <code>Address</code>).</p>
  
  <p><em>Person.cs</em></p>
  
  <pre><code>public class Person : ViewModelBase
  {
  }
  </code></pre>
  
  <p><em>Address.cs</em></p>
  
  <pre><code>public class Address : ViewModelBase
  {
      public Address() : base()
      {
         Model.OnModelChanged += Model_OnModelChanged;
      }
  
      private void Model_OnModelChanged(object sender, EventArgs e)
      {
      }        
  }
  </code></pre>
  
  <p>As you can see, <code>Address</code> on construction is hooking in to the model, this is the <strong>important part</strong>! </p>
  
  <p>The views for these two objects are.</p>
  
  <p><em>Person.xaml</em></p>
  
  <pre><code>&lt;Style TargetType="{x:Type local:Person}"&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type local:Person}"&gt;
                  &lt;StackPanel Orientation="Vertical"&gt;
                      &lt;TextBlock Text="Person"/&gt;
                      &lt;local:Address/&gt;
                  &lt;/StackPanel&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p><em>Address.xaml</em></p>
  
  <pre><code>   &lt;Style TargetType="{x:Type local:Address}"&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="{x:Type local:Address}"&gt;
                      &lt;TextBlock Text="Address"/&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>The <code>Person</code> view introduces the <code>Address</code> viewmodel on it's own, If I add 2 instance of <code>Person</code> to a list on the main window, the view will create 2 new instances of <code>Address</code>, this is by design and great. </p>
  
  <p>My problem is, if you remove one of the instances of Person from the collection you're left with 2 instances of person and address, one that's held in memory by the event hook. </p>
  
  <p>If a viewmodel has been introduced to the visual tree by a view and hooks events how do you get rid of them?</p>
  
  <p><a href="https://i.stack.imgur.com/eUHf8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eUHf8.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/BYYV6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BYYV6.png" alt="enter image description here"></a></p>