What is Visual Tree in WPF?

 Posted by Shantanupatel on 3/6/2012 | Category: WPF Interview questions | Views: 3320 | Points: 40

* Visual tree is an expansion of a logical tree, in which nodes are broken down into their visual components.
* Visual tree contails all logical elements including all visual elements.
* The elements that appear in a visual tree derive from 'System.Windows.Media.Visual' and 'System.Windows.Media.Visual3D'.
* Visual tree is responsible for:
1) Rendering visual elements
2) Propagate element opacity
3) Propagate layout and render transforms
4) Propagate the 'IsEnabled' property
5) Do hit-testing
* Visual tree is dependent on Windows theme.
* Visual tree is empty until the window undergoes layout at least once. So it must be navigated in 'OnContentRendered' event handler.
* System.Windows.VisualTreeHelper class is used to traverse the logical tree.

Source: Interview | Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response