17
Windows Presentation Windows Presentation Foundation Foundation

Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Embed Size (px)

Citation preview

Page 1: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Windows Presentation Windows Presentation FoundationFoundation

Page 2: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

GoalGoal

The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows.

Included in version 3.0 of the Microsoft .NET Framework, WPF allows building interfaces that incorporate documents, media, two- and three-

dimensional graphics, animations, Web-like characteristics, and much more.

Page 3: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Illustrating the Problem Illustrating the Problem Suppose a hospital wants to create a new Suppose a hospital wants to create a new

application for examining and monitoring patients. application for examining and monitoring patients. The requirements for this new application's user The requirements for this new application's user interface might include the following: interface might include the following: Displaying images and text about the patient. Displaying images and text about the patient. Displaying and updating two-dimensional graphics Displaying and updating two-dimensional graphics

showing the patient's vital signs, such as heart rate showing the patient's vital signs, such as heart rate and blood pressure. and blood pressure.

Providing three-dimensional views and overlays of Providing three-dimensional views and overlays of patient information. patient information.

Presenting video of ultrasounds and other Presenting video of ultrasounds and other diagnostics, perhaps allowing physicians and nurses diagnostics, perhaps allowing physicians and nurses to add annotations. to add annotations.

Allowing hospital staff to read and make notations on Allowing hospital staff to read and make notations on documents describing the patient and her condition. documents describing the patient and her condition.

Running both as a Windows application, allowing full Running both as a Windows application, allowing full capability for hospital employees, and in a security-capability for hospital employees, and in a security-restricted Web browser application, allowing more restricted Web browser application, allowing more limited access by remote physicians via the Internet. limited access by remote physicians via the Internet.

Page 4: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Changing PerspectiveChanging Perspective

User interfaces that present the right User interfaces that present the right information in the right way at the right information in the right way at the right time can have significant business value.time can have significant business value.

Modern applications can benefit from Modern applications can benefit from providing interfaces that integrate providing interfaces that integrate graphics, media, documents, and the graphics, media, documents, and the other elements of a modern user other elements of a modern user experience.experience.

Page 5: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

The HurdlesThe Hurdles

Variety of technology : difficult to find Variety of technology : difficult to find developers.developers.

Designing an interface that effectively Designing an interface that effectively presents all of this functionality to users is presents all of this functionality to users is challenging. challenging.

Professional designers are required—Professional designers are required—software developers don't have the right software developers don't have the right skills—but designers and developers face skills—but designers and developers face significant challenges in working together, significant challenges in working together, especially with full-featured interfaces like especially with full-featured interfaces like the one described here. the one described here.

Page 6: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

The HurdlesThe Hurdles

Offering a full-featured interface as both a Offering a full-featured interface as both a standalone Windows desktop application standalone Windows desktop application and a browser-hosted version would and a browser-hosted version would require building two separate require building two separate implementations using two different sets implementations using two different sets of technology. of technology.

The Windows desktop application would The Windows desktop application would likely use Windows Forms and other native likely use Windows Forms and other native Windows technologies, while the browser-Windows technologies, while the browser-hosted application would use HTML and hosted application would use HTML and JavaScript. JavaScript.

Two different groups of developers with Two different groups of developers with two quite different skill sets are needed. two quite different skill sets are needed.

Page 7: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Addressing the Problem: What Addressing the Problem: What Windows Presentation Foundation Windows Presentation Foundation

Provides Provides Three aspects of what WPF provides Three aspects of what WPF provides

stand out as most important. They stand out as most important. They are: are: a unified platform for modern user a unified platform for modern user

interfaces,interfaces, the ability for developers and designers the ability for developers and designers

to work together, to work together, and a common technology for Windows and a common technology for Windows

and Web browser user interfaces. and Web browser user interfaces.

Page 8: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Where am I?Where am I? To create the forms, controls, and other typical To create the forms, controls, and other typical

aspects of a Windows graphical user interface, aspects of a Windows graphical user interface, a developer would most likely choose Windows a developer would most likely choose Windows Forms, part of the .NET Framework. Forms, part of the .NET Framework.

If the interface needs to display documents, If the interface needs to display documents, Windows Forms has some support for on-Windows Forms has some support for on-screen documents, while fixed-format screen documents, while fixed-format documents might use Adobe's PDF. documents might use Adobe's PDF.

For images and two-dimensional graphics, that For images and two-dimensional graphics, that developer will use GDI+, a distinct developer will use GDI+, a distinct programming model that is also accessible via programming model that is also accessible via Windows Forms. Windows Forms.

To display video and audio, he might rely on To display video and audio, he might rely on Windows Media Player, and for three-Windows Media Player, and for three-dimensional graphics, he'll use Direct3D, a dimensional graphics, he'll use Direct3D, a standard part of Windows.standard part of Windows.

Page 9: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Who will help?Who will help?

Provide a single unified solution: Provide a single unified solution: WPF. Developers creating applications for WPF. Developers creating applications for

machines with WPF installed will likely use machines with WPF installed will likely use it to address all the areas listed above. it to address all the areas listed above.

After all, why not use one coherent After all, why not use one coherent foundation for creating user interfaces foundation for creating user interfaces rather than a diverse collection of rather than a diverse collection of independent technologies?independent technologies?

Yet by providing a broad range of Yet by providing a broad range of functionality in a single technology, functionality in a single technology, WPF can make creating modern user WPF can make creating modern user interfaces significantly easier. interfaces significantly easier.

Page 10: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

The Vision!The Vision!

Page 11: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Beyond!Beyond!

Page 12: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Unimaginable!Unimaginable!

Page 13: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Three in one flavor!Three in one flavor! The informationThe information The VideoThe Video The documentThe document

To define fixed format document , Microsoft has To define fixed format document , Microsoft has created the XML Paper Specification (XPS). created the XML Paper Specification (XPS).

WPF application programming interfaces (APIs) WPF application programming interfaces (APIs) can be use to create and work with XPS documents.can be use to create and work with XPS documents.

Unification of technologies is required to create a user Unification of technologies is required to create a user interface into a single foundation.interface into a single foundation.

WPF can make life significantly simpler for the people WPF can make life significantly simpler for the people who create those interfaces. who create those interfaces.

Creating and maintaining applications less expensive. Creating and maintaining applications less expensive. And by making it straightforward to build interfaces And by making it straightforward to build interfaces

that incorporate graphics, video, and more, WPF can that incorporate graphics, video, and more, WPF can improve the quality—and business value—of how improve the quality—and business value—of how users interact with Windows applications.users interact with Windows applications.

Page 14: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

The Ability for Developers and The Ability for Developers and Designers to Work TogetherDesigners to Work Together

To allow this, WPF introduces the eXtensible To allow this, WPF introduces the eXtensible Application Markup Language (XAML). XAML Application Markup Language (XAML). XAML defines a set of XML elements such as defines a set of XML elements such as ButtonButton, , TextBoxTextBox, , LabelLabel, and many more to define , and many more to define exactly how a user interface looks. exactly how a user interface looks.

XAML elements typically have attributes as well, XAML elements typically have attributes as well, allowing various options to be set. allowing various options to be set.

For example, this simple XAML snippet creates a For example, this simple XAML snippet creates a red button containing the word "No":red button containing the word "No":

<Button Background="Red"><Button Background="Red">

NoNo

</Button></Button>

Page 15: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

The Answer XAMLThe Answer XAML

Each XAML element corresponds to a WPF Each XAML element corresponds to a WPF class, and each of that element's class, and each of that element's attributes has a corresponding property or attributes has a corresponding property or event in the class. For example, the same event in the class. For example, the same red button could be produced with this C# red button could be produced with this C# code:code:Button btn = new Button();Button btn = new Button();

btn.Background = Brushes.Red;btn.Background = Brushes.Red;

btn.Content = "No"; btn.Content = "No";

Page 16: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

Why XAML?Why XAML?

If everything expressible in XAML is also If everything expressible in XAML is also expressible in code—and it is—what's the expressible in code—and it is—what's the value of XAML? value of XAML?

The answer is that building tools that The answer is that building tools that generate and consume XML-based generate and consume XML-based descriptions is much easier than doing the descriptions is much easier than doing the same thing with code.same thing with code.

Because XAML offers a tool-friendly way to Because XAML offers a tool-friendly way to describe a user interface, it provides a describe a user interface, it provides a better way for developers and designers to better way for developers and designers to work together. work together.

Page 17: Windows Presentation Foundation. Goal The goal of Windows Presentation Foundation (WPF) is to provide these advances for Windows. Included in version

The Gamut!The Gamut! A designer can specify how a user interface should A designer can specify how a user interface should

look and interact using a tool such as Microsoft look and interact using a tool such as Microsoft Expression Interactive Designer. Oriented entirely Expression Interactive Designer. Oriented entirely toward defining the look and feel of a WPF toward defining the look and feel of a WPF interface, this tool generates a description of that interface, this tool generates a description of that interface expressed in XAML. interface expressed in XAML.

A developer then imports that XAML description A developer then imports that XAML description into a tool such as Microsoft Visual Studio. into a tool such as Microsoft Visual Studio.

Rather than recreating the interface from scratch Rather than recreating the interface from scratch based on static images produced by a designer, based on static images produced by a designer, the interface definition itself is adopted wholesale. the interface definition itself is adopted wholesale.

The developer then writes the code for the The developer then writes the code for the interface, such as event handlers, along with any interface, such as event handlers, along with any other functionality the application requires. other functionality the application requires.

It's also possible to create styles that can be It's also possible to create styles that can be globally applied to an application's interface, globally applied to an application's interface, allowing it to be customized as needed for different allowing it to be customized as needed for different situations.situations.