Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > .NET > C#.NET > Visual Layer Overview(2)--Visual Tree
【标  题】:Visual Layer Overview(2)--Visual Tree
【关键字】:Visual,Layer,Overview,--Visual,Tree
【来  源】:http://blog.csdn.net/Net_Ghost/archive/2006/06/09/783602.aspx

Visual Layer Overview(2)--Visual Tree

Your Ad Here
visual tree包含一个应用UI中所有的可视化的元素(visual elements)。既然一个可视化元素中包含永久化的描画信息,可以认为visual tree是一个包含组成显示设备上输出的所有渲染信息的场景图。这棵树是应用直接创建的可视化元素的一个集合,无论使用代码创建的还是用标记语言创建的。visual tree还包括通过模版扩展的元素。
下面的例子定义了一个StackPanel元素
XAML
<StackPanel>
 <Label>User name:</Label>
 <TextBox />
 <Button Click="OnClick">OK</Button>
</StackPanel>
 
如果枚举组成StackPanel元素的可见对象的例子,可以得到下图所示的层次结构:
 

Rendering Order

 
 
 
 
Root visual visual tree层次结构中最顶层的元素,在大多数应用程序中,root visual的基类通常是Window或者NavigationWindow。可是,如果在Win32应用中hosting 可见对象的话,root visual就是Win32 window中最顶层的元素。For more information, see Hosting Visual Objects in a Win32 Application.
 
Relationship to the Logical Tree
Windows Presentation Foundation中的logical tree表示应用程序运行时的元素。虽然你不会直接的操作这个树,但是这种对应用的视角对于理解property inheritance event routing是很有帮助的。与visual tree不同,logical tree 可以表示不可见的data objects,例如:ListItem。在大多数情况下,logical tree几乎就是应用程序标记语言的近似映射。下面的代码显示了一个在标记语言中定义的DockPanel元素。
 
XAML
<DockPanel>
 <ListBox>
    <ListBoxItem>Dog</ListBoxItem>
    <ListBoxItem>Cat</ListBoxItem>
    <ListBoxItem>Fish</ListBoxItem>
 </ListBox>
 <Button Click="OnClick">OK</Button>
</DockPanel>
如果要枚举组成DockPanellogical objects的话,将得到下图的层次结构
 
visual tree logical tree都与当前的应用的元素同步,反映任何元素的增加,删除或者修改。但是它们显示了应用的不同视图。与visual tree, logical tree并没有扩展控件的ContentPresenter元素。这意味着并没有logical tree visual tree 之间的一一对应。实际上,在同一对象上调用LogicalTreeHelper's GetChildren me方法和VisualTreeHelper's GetChild 方法,将得到不同的结果。
For more information on the logical tree, see Element Tree.

文件访问通知:【上一篇】
自定义图片填充工作流外观:【下一篇】
【相关文章】
  • 让 NDoc 1.3 支持.NET 2.0 程序集,泛型输出和 Visual studio 2005 解决方案导入
  • ASP.NET 'Atlas' Overview
  • Visual Studio Team Foundation Server (TFS) 安装无废话教程
  • XML到TreeView的Function
  • mendia player 9.0要与.net框架通信,还必须注册mendia player 9.0的pia
  • 以Debian方式编译MPlayer SVN
  • 让treeview控件显示滚动条(Asp.net 1.1)
  • Visual Studio一个BUG
  • linux上的mplayer的安装
  • 急求购--Microsoft Windows CE Toolkit for Visual Basic 6_0
  • 【随机文章】
  • 绝对真实的笑话,你没这么干过?
  • 典型家用综合布线系统讲解(3)
  • How startup applications are configred on Windows system?
  • 文档-体系结构设计报告
  • 墨香 贺岁版七大任务完全解析
  • cas-group (控制器e1)
  • MTA 错误讯息代码解析
  • 渥太华2006 Linux大会: Greg Koroah-Hartman演讲文稿(原文)
  • c语言调用c++函数
  • 学完MCSE后你能做些啥???
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.