Introduction to WPF

Source: Internet
Author: User
Tags definition expression advantage

1. What is WPF

WPF is the abbreviation of Windows Presentation Foundation, its original code name is "Avalon", because "I admire" pinyin first letter combination, some people in the country call it "I admire". WPF is a new generation of Microsoft graphics system, running under the. NET Framework 3.0 architecture, provides a unified description and operation method for user interface, 2d/3d graphics, document and media. Based on DirectX 9/10 Technology, WPF not only brings an unprecedented 3D interface, but also its graphics vector rendering engine greatly improves the traditional 2D interface, such as the translucent effect of the form in Vista, and so on, thanks to WPF.

With the help of WPF, it is no longer a distant hope to develop a cool interface to match Mac programs. WPF is a huge step forward in relation to the development of Windows clients, providing an extremely rich. NET UI framework, integrated vector graphics, rich streaming text support for flow text support,3d visuals, and a powerful control model framework.

Industry famous personage exclaimed: "This day finally comes!" ”

WPF and XAML

In the the mid 1990s, the application of XML derived from SGML has become extremely popular. Many developers see XML as a panacea for all computer development problems, and XML is almost ubiquitous.

For Vista operating systems, Microsoft provides specialized interface development language XAML (extensible Application Markup Language, Extensible Application Markup Language). XAML, as the interface Description Language of Microsoft Vista operating system, can customize all the interface elements of a WPF program to build a dazzling software interface.

XAML as an Interface description language (note "language"), it will eventually be compiled into. NET background code. Therefore, it can be logically processed with the background. NET language such as C #, J #, C + +, VB work together, its work is similar to the HTML in asp.net. The generation of XAML makes the interface description code and program code separate, which improves development efficiency and facilitates team development.

Like HTML, XAML can be either encoded directly or generated by specialized tools. The best XAML editor at the moment is expression Blend, but you can also use the XAMLPad in Windows SDK for Windows Vista, but the functionality is too simple.

2. Why WPF is admirable

The perfect user experience has long been a major barrier to desktop applications and Web applications. Many developers racked their brains to design the interface to be beautiful, more dynamic, but the cost of Dickens, or passable. Because of technical limitations, WEB applications cannot provide the same rich user experience as desktop applications. And as the computer and everyone's life, work become inseparable, people on the desktop application requirements are constantly improving. People who are never satisfied require desktop applications to be able to play video, run animations, take two-dimensional or three-dimensional graphics, and invoke different documents.

Do you want to achieve this? Then use the wpf!. The popular advertising words: Use all say yes!

With WPF, you can create rich, wonderful connectivity applications to take full advantage of the Windows platform, including UI, media, offline communications, and document support.

First, the design process of the WPF program.

Generally, most WPF programs will contain both XAML code and program code. We first use the XAML definition program interface (as mentioned earlier, can be written manually, and can be written using experssion blend and other visual tools), and then used. NET language (C #, VB. NET, etc.) to write the corresponding logical code. Like asp.net, logical code can be embedded either directly in a XAML file or as a stand-alone code file.

Although XAML is not necessary to design a WPF program, we can still use the program code in the traditional way to make the interface design. However, if you use XAML, the interface design and logical design can be completely detached. In this way, not only makes the program development and maintenance more convenient, and when the team development, can really achieve "professional people do professional things", the interface design to the professional art designers to complete, and let us energy and time are valuable programmers dedicated to the realization of business logic. Truly "every effort to do their job," and eventually a powerful, interface-class WPF program. At this time, just wait for the user "satisfied with a smile, happy to pay the bill."

It is said that the people today are pragmatic and efficient. So what are the real benefits of WPF for our desktop applications and Web applications?

First, a set of coding, desktop applications and Web applications can be used, of course, cost savings. Of course, some time, it is necessary to change the appropriate code. But the amount of change is so small that you're amazed by the great Microsoft, so you have to take (WPF's "I Admire" legends about this?) )。

Second, WPF not only makes it beautiful and versatile, it also makes the web more colorful. WPF makes it possible for 3D to enter the Web. For example, you can use vector graphics design software (Illustrator, CorelDRAW, etc., Microsoft also has!) Call "Expression Designer") to design a picture, and then output or export graphics to XAML format. You can then open the XAML file in blend, make it animated, and finally generate XAML. Pass. NET languages, such as C #, and can control these XAML. Coupled with vs2005/2008 excellent development environment, can be described as "cattle b invincible." xaml+ C # is a big trend that will attract a large number of enthusiasts (from Microsoft. NET's success, has been confirmed from one side of this point).

More technical details.

In fact, WPF's scope of support is much more than the basic user interface application, and includes:

(1) Changes in documentation. It is called "change" because it can not only use the traditional screen display/print document (XPS), but also use the FlowDocument tag to display flow documents. The document can not only have text, pictures, links, but also can have three-dimensional animation, video and so on. Imagine a romantic picture of all the time when you are with him/her on some important day, warm video, sweet words, and smart signatures, play your rich imagination, make a dynamic animation, or rich fun interactive game, save it as a multimedia document, at the right time, What kind of feeling does he/she see after taking advantage of the right opportunity to give it to him or her? At the right time, at the right place, by the right people to do the right thing, this is the most "appropriate"!

(2) Graphics: WPF supports the creation of two-and three-dimensional vector graphics. For two-dimensional graphics, WPF provides standard abstractions, such as shapes, brushes, and pens, as well as a three-dimensional graphics definition model for specifying light and camera position information. Unlike earlier technologies (GDI, GDI +), WPF graphics are not graphical images drawn using a single set of concepts that developers must understand, and XAML elements for graphical descriptions can be naturally combined with other elements of those user interfaces. For example, a button, can be text, but also with graphics and text combinations, but also can have more features.

(3) Image: WPF uses XAML image tags to display graphics in different formats, including jpeg,gif,png and other formats, in your application. WPF relies on WIC (Windows Imaging Component) to provide a standard framework for codecs, as well as software that displays and stores images. In WPF, a typical image element can be combined with other elements, such as a button, that can be displayed as an image button rather than a simple text label.

(4) Multimedia video and audio: WPF can use the MediaElement tag to display video and audio in different formats, including WMV, AVI, and MPEG. Again, this element can be combined with other XAML elements, and even more surprisingly, you can make video appear on all sides of a three-dimensional cube. Continue to use your imagination, you can make them move, such as 3D rotation, drag or zoom a certain side, or make the effect you want. In this world, you can really do "how bold people are, how much production".

(5) Animation: WPF provides built-in support for dynamic display of the vast majority of user interfaces. For example, enlarge and shrink the rectangle, and change the button size. Like the timeline in Adobe Flash, you can also define a storyboard that contains timelines, or you can adjust the order in which the animation occurs.

(6) Data binding: the need to display data based on most programs, WPF provides automatic support for mapping data to user interface elements. Like ASP.net, WPF provides data binding for information contained in objects and other sources, and also allows sorting and filtering of data before it is displayed.

Finally, the original graphics image can be reused, so that your original investment to maximize the benefits.

Because the XAML is based on XML, its format is open. There are a number of useful conversion tools available on the market that can be used to export graphic images, 3D animations, etc. that you originally produced in other design software (such as Photoshop, Illustrator, Affecteffects, other three-dimensional design software, etc.) into XAML.

3. Sando Mamang--WPF's challenge to Adobe

Not a friend is not Jutou. It seems that this time Microsoft and Adobe, there is a fight between the Ming and the dark.

Is it possible that Microsoft has aggressively entered the UI field to showdown with Adobe? Microsoft's ambition, no one can see through. is not the world is a lot of road, go more people, there is no way to go? In short, this kind of hand-to-hand competition, for the vast number of users, always positive.

Let's take a look at Microsoft's expression series, and then look at the impact on WPF.

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.