Microsoft Developer Network > Página Inicial dos Fóruns > Windows Presentation Foundation (WPF) > Composing an application for rendering performance
Fazer uma PerguntaFazer uma Pergunta
 

RespondidoComposing an application for rendering performance

  • domingo, 8 de novembro de 2009 5:47Mark Macumber Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    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

Respostas

  • segunda-feira, 9 de novembro de 2009 8:11Hua ChenMSFT, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    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

Todas as Respostas

  • segunda-feira, 9 de novembro de 2009 8:11Hua ChenMSFT, ModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    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