WPF and XAML

Source: Internet
Author: User

Windows Presentation Foundation (WPF) is a new generation of Microsoft Graphics system running in. net Framework 3.0 provides a unified description and Operation Method for user interfaces, 2D/3D graphics, documents, and media. Based on directx9/10 technology, WPF not only brings unprecedented 3D interfaces, but also greatly improves the traditional 2D interface by its graphic vector smoke and dyeing engine, for example, Windows Vista's translucent forms all benefit from WPF.

General WPFProgramWith XAMLCodeAnd program code (such as C #, VB. net), just like ASP. NET page is composed of HTML code and program code (such as C #, VB.. net. The WPF program uses the XAML to define the program interface, and then uses the. NET language (such as C # and VB. NET) to write the corresponding logic code. Logical code can be directly embedded into a XAML file or saved as an independent code file.

XAML (XML for applications Markup Language) is an XML syntax used to define the hierarchy of the user interface/XAML to separate the UI code from the application logic code. In. Net 3.5 and Windows Vista, XAML and WPF build the entire UI together. Since XAML is based on XML, every XAML code must be a complete XML file. XAML inherits all XML definitions and rules. The difference between XAML and other XML extensions lies in its meaning. Each XAML element is a. Net CLR class. XML makes it easy for us to extend and operate XAML. With the relationship of WPF in XAML, developers can independently design beautiful UIS. We can write the program logic in a separate file or embed it in an XML file.

Up to three XML functions are used in XAML: namespaces, attributes, and child elements.

The following is a simple example of XAML:

<Window X: class = "wpfapplication1.window1"
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" // xmln is the namespace of XML

Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Title = "WPF Application" Height = "300" width = "300" allowstransparency = "false">
<Grid background = "aliceblue" width = "272" Height = "159" showgridlines = "false">
<Button margin = "88,55, 116,0" name = "button1" Height = "23" verticalignment = "TOP" Click = "button#click"> click </button>
</GRID>
</WINDOW>

XAML is compiled into a baml (Binary Application Markup Language) file. Generally, banl files are smaller than XAML, And the compiled baml files are pre-tokenized, so that you can load and analyze XAML more quickly during running. These baml files are embedded into the Assembly as resources. Generate the corresponding code (the file name is **. g. CS or **. g. VB), the code generates the named attribute field based on the XAML element, and loads the baml constructor.

Professional design tools required for efficient development of WPF applications include Microsoft Expression design and Microsoft Expression blend.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.