WPF 学习(1)
Two element trees exist within a WPF application: the logical tree and the visual tree.
logical tree
包含了element in xaml and 代码
textbox , and other :their composition and behavior within the programming model and the visual tree are quite different.
Visual Tree
For each element in the logical tree, additional elements may be created to represent visual aspects required by the element.
这一点和aspx相似,web control render.
The visual system is the subsystem through which applications access the core presentation services available through WPF. This subsystem examines the components within an application (labels, buttons,text, 2D and 3D graphics, animations) and will communicate with the underlying composition system
(via the message transport) to generate the rendered result to the screen.
显示系统通过消息和底层交互。那么是不是可以通过重写消息机制,或者底层实现动态换肤或者还有更好的办法。这里肯定有啥可扩展的。
the font system interacts with two main subsystems—the element system and the visual system—each for a different purpose:
❑ The font system interacts with the element system’s Page and Table Service (PTS). PTS is
responsible for the organization and layout of text within the UI. This includes paragraphs,
tables, and blocks of text.
❑ The visual system leverages the font system for text layout services within a single line of text,
such as kerning, leading, and spacing.
Event Router
Property system
❑ Change notification
❑ Storage
❑ Expressions
change notification
wpf 使用 dependence property 来定义 属性变化。
properties are the main data element of WPF
expressions
<Window.Resources>
<Style TargetType=”{x:Type Button}”>
<Setter Property=”FontFamily” Value=”Segoe Black” />
<Setter Property=”FontSize” Value=”12pt” />
<Setter Property=”Foreground” Value=”#777777” />
<Setter Property=”HorizontalAlignment” Value=”Center” />
</Style>
表达式可以使用在wpf中任何地方。
Message Transport System
The message transport service is a key component of the WPF architecture that ties the visual system to the composition system。
message transport system提供通道连接visual system 和 底层,其中实现了一种远程服务,用于数据的传输,可以对这里进行扩展,以支持类似于服务端,客户端表现的功能。
composition system 非托管代码负责处理与gpu以及软件的交互。
基本元素
1.xaml
2.appliation object 和 global相似。
Application myApp;
myApp = System.Windows.Application.Current;