Windows Presentation Foundation Introduction(I) - Overview

9 篇文章 0 订阅

/*by Jiangong SUN*/


Windows Presentation Foundation (or WPF) is a computer-software graphical subsystem for rendering user interfaces in Windows-based applications. 
WPF, previously named "Avalon", was initially released as part of.NET Framework 3.0 with WCF, Windows WorkFlow and CardSpace. 


Avalon(阿瓦隆)是凯尔特人传说中的西方乐土岛

WPF utilise DirectX which is a collection of APIs who handle tasks about multimedia, game programming and video.
Direct3D (3D graphics API within DirectX) is widely used in development of video games and CAD/CAM engineering. 


XAML eXtensible Application Markup Language (was called eXtensible Avalon Markup Language), is a declarative language based on XML for initializing structured values and objects. 
WPF use XAML to define and link various UI elements for developing standalone desktop applications or browser applications.


The architecture of WPF spans across both managed code and native code components.

WPF consists of three major components: PresentationFramework(managed code), PresentationCore(managed code), milcore(native code)


Media Integration Layer(MIL)
's physical assembly is milcore.dll, it works directly with DirectX and provides support for 2D, 3D and visual surfaces.
PresentationCore (presentationcore.dll) provides a managed wrapper for MIL and implements the core services for WPF, including a property system that is aware of the dependencies between the setters and consumers of the property, a message dispatching system by means of a Dispatcher object to implement a specialized event system and services which can implement a layout system such as measurement for UI elements.
PresentationFramework (presentationframework.dll) implements the end-user presentational features, including layouts, time-dependent, story-board based animations, and data binding


WPF features

XAML based user interfaces, Page layout management, Data binding, 2D and 3D graphics, Multimedia, Animation, Security, Interoperability with Windows Forms Controls, Localisation, Accessibility etc.


WPF Event Model

Clicking buttons, Entering text, Selecting lists, Gaining focus

Types of WPF application

Stand-Alone Applications (WPF Applicaiton),XAML Browser Applications (XBAPs) (WPF Browser Application)


You use the stand-alone application type when you want to create traditional Windows-based applications such as word processors or line-of-business applications to deploy to individual client computers.
XAML browser applications (XBAPs) more closely represent the traditional Microsoft ActiveXor Component Object Model (COM) based controls that are hosted in a browser model. You use this type of application when your application can run with limited permission, when a browser can host the application, and when a simplified distribution and update model is a primary goal.

WPF Routed events:
Functional definition: A routed event is a type of event that can invoke handlers on multiple listeners in an element tree, rather than just on the object that raised the event. 
Implementation definition: A routed event is a CLR event that is backed by an instance of the RoutedEvent class and is processed by the Windows Presentation Foundation (WPF) event system. 
The event route can travel in one of two directions depending on the event definition, butgenerally the route travels from the source element and then "bubbles" upward through the element tree until it reaches the element tree root (typically a page or a window). 

WPF routed events typesDirect events, Tunneling events, Bubbling events

Direct events. Direct events are simple events that are raised on a single source. They are the closest to the standard .NET events,except that they are registered with the WPF routed-event system.
Tunneling events. Tunneling events travel from the root of the element tree to the source element.
Bubbling events. Bubbling events are the opposite of tunneling events and travel from the source element to the root of the element tree.


XAML Editor:
XAMLPAD.exe is a visual editor for xaml


WPF Command:
A command is an input mechanism that provides input handling at a more semantic and abstract level. You use a command instead of an event handler that is attached to a button or similar control when you want multiple sources to invoke the same command logic.


WPF Commands basic types: Cut, Copy, Paste

Example: 

ApplicationCommands.Cut, ApplicationCommands.Copy, ApplicationCommands.Paste

You can use the predefined commands in WPF by using the ApplicationCommands, NavigationCommands, MediaCommands, EditingCommands, and the ComponentCommands classes or you can create your own commands. Some controls, such as TextBox and RichTextBox, provide implementations for the common command scenarios, such as Cut, Copy, and Paste.


Navigation model: From one page to another page, from one page to a fragment in another page
For example:

<Hyperlink NavigateUri="Page2.xaml#MyFragment">
   Page 2 Fragment
</Hyperlink>



I hope my article can help ! Enjoy coding !

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值