Microsoft Developer Network > Domovská stránka fór > Windows Presentation Foundation (WPF) > Composing an application for rendering performance
Odeslat dotazOdeslat dotaz
 

OdpovědětComposing an application for rendering performance

  • 8. listopadu 2009 5:47Mark Macumber Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     
    Hey guys,

    I have an application that contains 3 core parts, each of which has a relatively large amount of graphics effects on them. I want the user to be able to navigate to and from them easily, so I have composed my app very simply, into one large Canvas, which contains 3 child canvas'. Each being the different parts of the application.

    My question is, to ensure that the non-active parts of the application do not hog any of the system resources, can I just set the Visibility to Hidden on the containing canvas? Will that remove it from the visual tree altogether (at least in terms of the rendering logic?)

    Thanks
    Mark

Odpovědi

  • 9. listopadu 2009 8:11Hua ChenMSFT, ModerátorUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     Odpovědět
    Hello Mark,

      My question is, to ensure that the non-active parts of the application do not hog any of the system resources, can I just set the Visibility to Hidden on the containing canvas? 

      Yes. Setting the Canvas' visibility to Hidden saves the resource. 

      Will that remove it from the visual tree altogether (at least in terms of the rendering logic?)

         A UIElement that is not visible does not render and does not communicate its desired size to layout.

         But that doesn't remove it from Visual Tree,

           1. Hidden does not display the element, but reserve space for the element in layout. 

           2. Collapsed does not display the element, and do not reserve space for it in layout
     
           Elements is still in the Visual Tree for both 'Hidden' and 'Collapsed' 

     Related links.

        Optimizing WPF Application Performance
     
      Thanks.

    Please mark the replies as answers if they help and unmark them if they provide no help

Všechny reakce

  • 9. listopadu 2009 8:11Hua ChenMSFT, ModerátorUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     Odpovědět
    Hello Mark,

      My question is, to ensure that the non-active parts of the application do not hog any of the system resources, can I just set the Visibility to Hidden on the containing canvas? 

      Yes. Setting the Canvas' visibility to Hidden saves the resource. 

      Will that remove it from the visual tree altogether (at least in terms of the rendering logic?)

         A UIElement that is not visible does not render and does not communicate its desired size to layout.

         But that doesn't remove it from Visual Tree,

           1. Hidden does not display the element, but reserve space for the element in layout. 

           2. Collapsed does not display the element, and do not reserve space for it in layout
     
           Elements is still in the Visual Tree for both 'Hidden' and 'Collapsed' 

     Related links.

        Optimizing WPF Application Performance
     
      Thanks.

    Please mark the replies as answers if they help and unmark them if they provide no help