Overview of WPF
User Experience (UX) matters because it helps end-users use products in an easy way (easy to use, relevant, secure, etc.).
The things that make a software have a good UX is richness, data viz, globalization, accessibility, etc.
UX can be easily measured based on success of usage, productivity, retention, comprehension, and so on.
Windows Presentation Foundation (WPF):
WPF Features :
- Broad integration -2D, 3D graphics, Audio, Video, Speech…
- Resolution Independence- Vector Graphics
- Hardware Acceleration – Usage of GPU
- Declarative Programming - XAML
- Rich Composition and Customization – Control Templates
WPF combine the best attributes of systems such as DirectX (3D and hardware acceleration), Windows Forms (developer productivity), Adobe Flash (powerful animation support), and HTML (declarative markup).
Windows Presentation Foundation (WPF) is a productive, unified approach to UI, Media, and Documents that you can use to deliver unmatched user experiences to your customers
WPF is the next-generation Windows smart-client UI technology:
Immersive Desktop applications – Includes rich ISV and LOB applications that can be deployed to Windows as a stand-alone client.
Enterprise Intranet applications – A unique capability of WPF is that you can use the same code base to deploy a WPF app either as a stand-alone desktop client, or in the browser. This lets you maintain just one code base for enterprise applications that are needed in both deployment models - stand-alone and in the browser. This dramatically lowers TCO.
Windows Media Center applications - Current Media Center spotlight apps are created mostly in DHTML. WPF offers a much more sophisticated visual toolbox to create a great user experience that scales to different form factors (from CRT monitors to laptop LCDs to big screen TVs), thanks to its DPI-independent resolution. End-users using Media Center Extender can also navigate using their remote controls Now that’s user experience!
Premium Internet applications – As consumers, we may often be avid “super” users of certain internet applications, while at the same time being just casual users of most other internet applications. As avid users, we often expect an exclusive user experience that’s better than the norm. WPF (that is XAML Browser Applications or XBAPs), through its UI and media integration (audio, video, sound, animation, 2D, 3D, document services, styling, data binding, etc.), is a great platform to build these rich internet applications, where exclusivity is a requirement.
WPF is Microsoft’s strategic presentation technology for Windows smart client user experiences. Use WPF to deliver innovative user interfaces through support for UI, media, document services, hardware acceleration, vector graphics, resolution-independent DPI for different form factors, data visualization, and superior content readability. Increase developer-designer productivity and collaboration through Visual Studio, Microsoft Expression Interactive Designer, and XAML. Write code once, and deploy as stand-alone client or in a browser. Incrementally embrace WPF through interoperability with Win32 and Windows Forms. Leverage vested knowledge in .NET Framework, CLR languages and Visual Studio IDE. Derive business value through new paradigms of user experiences, business intelligence through data visualizations, brand awareness through differentiated customer experiences, and customer loyalty through higher customer satisfaction.
The Windows Presentation Foundation graphics system uses device-independent units to enable resolution and device independence. Each device independent pixel automatically scales with the system's DPI setting. As an example, see how a WPF app can scale from a 6 in. Sony VAIO to a 72 inch big screen TV (Media Center apps).
Improved precision. The Windows Presentation Foundation coordinate system uses doubles and floats. Transformations and opacity values are also expressed using doubles. Windows Presentation Foundation also supports a wider color gamut (scRGB) and provides integrated support for managing inputs from different color spaces.
Advanced graphics and animation support. Windows Presentation Foundation provides a scene graph/scene partitioning solution, which includes hit testing support and minimal redraw features, as well as an integrated glitch-free animation system. It also provides full alpha compositing support.
Hardware acceleration. The Windows Presentation Foundation graphics system is designed to take advantage of graphics hardware (GPU) to minimize CPU utilization.
Designer - Developer productivity:
If user experience matters, design matters.
If design matters, designers matter.
If designers matter, we need to make designers first class citizens of the traditional software development process.
Let’s talk about how Microsoft is unlocking Developer and Designer collaboration and is empowering them to create successful UX software applications.
1) Traditionally designers would “mockup” the graphic design for a software application. Then by any means possible designers would deliver this “looks” to the developer… they would use JPG images, PNGs, PSDs or even Powerpoint presentations to express the designer intention. Then the developer would receive this “static images” and would try to convert that into reality. If the designer created some “non standard” controls, the developer was forced to code in GDI+ or other complex technologies to create the control raising the time and budget to such level that it was simply better to take the decision of making the UI more “standard”. The developer trying to recreate the idea of the designer would deliver something like what is shown on the right side of the screen. As you can see it represents only a tiny bit of the original vision.
2) In order to enable the collaboration between developers and designers, Microsoft has created XAML. XAML is the format which integrates the development process and is the way for both developers and designers to access the functionalities of WPF. As you can see we have no middle man anymore. XAML is generated by the designer, XAML is consumed by the developer. Further more, the workflow is now two-way meaning that the development process can also start from the developer side who creates XAML and then delivers this XAML to the designer which can take it and style it or completely redesign its appearance.
3) As a brief sample this are the tools that enable this kind of process: On the designer side we have Expression and on the Developer side we have Visual Studio.
Declarative Programming Through XAML:
Stands for Extensive Application Markup Language
Easily toolable, declarative markup
Build applications in simple declarative statements
Can be used for any CLR object hierarchy
Code and content are separate
Streamline collaboration between designers and developers
Developers add business logic, while designers design
Can be rendered in the browser (as part of a web page) or as a standalone application
WPF introduces a new role to the rich client software development team – that of professional designer. Gone are the days of boring gray buttons and poorly designed applications: with the declarative programming model enabled by XAML, you can split off presentation and logic in the same way as with a web application. XAML is a markup language that is inherently toolable, allowing for designers and developers to use independent tools.
XAML (which stands for "Extensible Application Markup Language") provides an XML-based way to specify declaratively a hierarchy of objects with properties and logic. We're positioning XAML as a user interface design language, because it is ideal for generating the kind of code that traditionally resided in a hidden #region area and was hard to maintain by both developers and tools. If you've ever wanted to edit the auto-generated blocks of code created by Visual Studio but been dissuaded by the warning comments writ large, or you've gone ahead regardless and been burnt badly when your tools refused to load your changes, you'll appreciate XAML. XAML is not Avalon, and Avalon is not XAML. It so happens that they come out of the same team at Microsoft, but they are not intrinsically wedded together. I've been asked before "where can I go to get the XSD for XAML?" and hopefully it's now clear that this question doesn't make much more sense than asking for the C# schema. XAML gets compiled into an object definition.
Controls,Templates, Styles And Animation:
WPF provides a rich set of controls – Border, BulletDecorator , Button, Canvas , CheckBox , ComboBox , ContextMenu , Control , DockPanel , DocumentViewer, Expander , FlowDocumentPageViewer , FlowDocumentReader , FlowDocumentScrollViewer , Frame , Grid , GridSplitter ,
GridView , GroupBox , Image , Label , ListView , ListBox , Menu , Panel , PasswordBox , Popup , Tooltip, etc….
Animation, Triggers and Timelines – This can be accomplished using a timeline, using Expression Blend.
Data binding is the process that establishes a connection between the application UI and business logic. A typical use of data binding is to place server or local configuration data into forms or other UI controls. In Windows Presentation Foundation, this concept is expanded to include the binding of a broad range of properties to a variety of data sources. In WPF, dependency properties of elements can be bound to CLR objects (including ADO.NET objects or objects associated with Web Services and Web properties) and XML data.
Dependency properties are properties that are registered with the Windows Presentation Foundation (formerly code-named "Avalon") dependency property system. You can take advantage of the dependency property system in the following ways:
By backing your common language runtime (CLR) property with a dependency property. This allows your property to have support for styling, databinding, animation, initial default values, value expressions, property invalidations, or inheritance. Examples of dependency properties include the Background property and the FontSize property.
By creating attached properties. Attached properties are properties that can be set on any DependencyObject types. An example attached property is the Dock property.
OneWay binding causes changes to the source to automatically update the target, but changes to the target are not propagated back to the source. This type of binding is appropriate if the control being bound is implicitly read-only. For instance, you may bind to a source such as a stock ticker or perhaps your target property has no control interface provided for making changes, such as a data-bound background color of a table.
TwoWay binding causes changes to either the source or the target to automatically update the other. This type of binding is appropriate for forms or other fully interactive UI scenarios. Most properties default to OneWay binding, but some dependency properties (typically properties of user-editable controls such as the Text property of TextBox and the IsChecked property of CheckBox) default to TwoWay binding. A programmatic way to determine whether a dependency property binds one-way or two-way by default is to get the property metadata of the property using GetMetadata and then check the boolean value of the BindsTwoWayByDefault property.
OneWayToSource is the reverse of OneWay binding; it updates the source when the target changes.
WPF supports the following audio/video formats.
Windows Media Video (.wmv) files are Advanced Systems Format (.asf) files that include audio, video, or both compressed with Windows Media Audio (WMA) and Windows Media Video (WMV) codecs.
MPEG (pronounced M-peg), which stands for Moving Picture Experts Group, is the name of family of standards used for coding audio-visual information (e.g., movies, video, music) in a digital compressed format. The major advantage of MPEG compared to other video and audio coding formats is that MPEG files are much smaller for the same quality. This is because MPEG uses very sophisticated compression techniques.
AVI, an acronym for Audio Video Interleave, is a multimedia container format introduced by Microsoft in November 1992, as part of the Video for Windows technology. AVI files contain both audio and video data in a standard container that allows simultaneous playback.
Open Document Specifications
Open Packaging Conventions and XML Paper Specification (XPS) for use by devices and any application on any platform.
WPF Document APIs
Application programming interfaces (APIs) to manage package and content.
XPS Print Path
Print pipeline with XPS spool format and printer-page description language to speed and improve print job fidelity. New driver model.
Print Driver for “Save As”
A print-to-file converter for creating XPS Documents from any Microsoft Windows-based application.
A WPF utility that allow users to view, protect and print XPS Documents. Hosted in IE.
You can incrementally embrace WPF, w/o throwing away your existing code base or skill set.
WPF-Windows Forms Interoperability
Host WPF controls in a Windows Forms application using WindowsFormsHost
Host Windows Forms controls in a WPF application using ElementHost
Augment the WPF features with Windows Forms features
WPF & HWNDs enable WPF interoperability with Win32, MFC, Active Template Library, ActiveX & DirectX
Use HWNDSource to host WPF inside HWNDs & to host HWNDs inside WPF