title: Is there a safe way to detach/unload behaviors without side effects?
body: <p>In WPF and WinRT it is well known that behaviors do not call their Detach method reliably. The only way to avoid a memory leak is to subscribe to the Unloaded event of the AssociatedObject and unhook all events (<a href="http://dotnetbyexample.blogspot.de/2011/04/safe-event-detachment-pattern-for.html" rel="noreferrer">example</a>).</p>
  
  <p>So far it works.</p>
  
  <p>But I realized (as did someone else who commented on the blog entry I linked)  that in this way unloaded behaviors are never attached again. Take a MenuFlyout for instance. If there is a behavior attached to a MenuFlyoutItem it is unloaded when the MenuFlyoutItem is closed. If you open the Menu again it won't be reattached.</p>
  
  <p>This also happen with other UserControls. I "lose" behaviors when navigating in my WinRT App from one Page to another and back again although all Controls are recreated anew. I don't see how I can use them in a WinRT App where a lot of Controls are recreated by navigating around.</p>
  
  <p>Is there any solution known to this?</p>