title: How to freeze all freezable WPF objects?
body: <p>I want to freeze all freezable object that are in a window.(to get better performance)</p>
  
  <p>To do it I used several loop like this:</p>
  
  <pre><code>    foreach (Brush item in FindLogicalChildren&lt;Brush&gt;(myWin))
                    if( item != null &amp;&amp; item.CanFreeze)item.Freeze();
  
      foreach (Transform item in FindLogicalChildren&lt;Transform&gt;(myWin))
                     if( item != null &amp;&amp; item.CanFreeze)item.Freeze();
  
      foreach (Geometry item in FindLogicalChildren&lt;Geometry&gt;(myWin))
                     if( item != null &amp;&amp; item.CanFreeze)item.Freeze();
  </code></pre>
  
  <p>But it does not work.</p>
  
  <p>How to call <code>Freeze()</code> on any freezable WPF object?</p>
  
  <p>EDIT:</p>
  
  <p>I just realized that the <code>FindLogicalChildren</code> not find anything, so it does not work.</p>
  
  <p>EDIT2:</p>
  
  <p>How to call Freeze() on any freezable objects by using ONE loop.</p>
  
  <p>Please help me.</p>