Microsoft Developer Network >
Página Inicial dos Fóruns
>
Windows Presentation Foundation (WPF)
>
Composing an application for rendering performance
Composing an application for rendering performance
- 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
- 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- EditadoHua ChenMSFT, Moderadorsegunda-feira, 9 de novembro de 2009 8:15Edit..
- Marcado como RespostaHua ChenMSFT, Moderadorsexta-feira, 13 de novembro de 2009 3:37
Todas as Respostas
- 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- EditadoHua ChenMSFT, Moderadorsegunda-feira, 9 de novembro de 2009 8:15Edit..
- Marcado como RespostaHua ChenMSFT, Moderadorsexta-feira, 13 de novembro de 2009 3:37

