HOME

TheInfoList



OR:

Windows Presentation Foundation (WPF) is a
free and open-source Free and open-source software (FOSS) is a term used to refer to groups of software consisting of both free software and open-source software where anyone is freely licensed to use, copy, study, and change the software in any way, and the source ...
graphical subsystem (similar to
WinForms Windows Forms (WinForms) is a free and open-source graphical user interface, graphical (GUI) Library (computing), class library included as a part of Microsoft .NET Core, .NET, .NET Framework or Mono Framework, providing a platform to write client ...
) originally developed by
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
for rendering
user interface In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
s in Windows-based applications. WPF, previously known as "Avalon", was initially released as part of
.NET Framework 3.0 Microsoft started development on the .NET Framework in the late 1990s originally under the name of Next Generation Windows Services (NGWS). By late 2001 the first beta versions of .NET 1.0 were released. The first version of .NET Framework was ...
in 2006. WPF uses
DirectX Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direct", ...
and attempts to provide a consistent programming model for building applications. It separates the user interface from
business logic In computer software, business logic or domain logic is the part of the program that encodes the real-world business rules that determine how data can be created, stored, and changed. It is contrasted with the remainder of the software that might ...
, and resembles similar
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
-oriented
object model In computing, object model has two related but distinct meanings: # The properties of objects in general in a specific computer programming language, technology, notation or methodology that uses them. Examples are the object models of ''Java'', ...
s, such as those implemented in
XUL XUL ( ), which stands for XML User Interface Language, is a user interface markup language developed by Mozilla. XUL is an XML dialect for writing graphical user interfaces, enabling developers to write user interface elements in a manner sim ...
and SVG.


Overview

WPF employs
XAML Extensible Application Markup Language (XAML ) is a declarative XML-based language that Microsoft developed for initializing structured values and objects. It is available under Microsoft's Open Specification Promise. XAML is used extensively ...
, an
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
-based language, to define and link various interface elements. WPF applications can be deployed as standalone desktop programs or hosted as an embedded object in a website. WPF aims to unify a number of common
user interface In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine f ...
elements, such as 2D/3D rendering, fixed and adaptive documents,
typography Typography is the art and technique of arranging type to make written language legible, readable and appealing when displayed. The arrangement of type involves selecting typefaces, point sizes, line lengths, line-spacing ( leading), and ...
,
vector graphics Vector graphics is a form of computer graphics in which visual images are created directly from geometric shapes defined on a Cartesian plane, such as points, lines, curves and polygons. The associated mechanisms may include vector display ...
, runtime
animation Animation is a method by which image, still figures are manipulated to appear as Motion picture, moving images. In traditional animation, images are drawn or painted by hand on transparent cel, celluloid sheets to be photographed and exhibited ...
, and pre-rendered media. These elements can then be linked and manipulated based on various events, user interactions, and
data binding In computer programming, data binding is a general technique that binds data sources from the provider and consumer together and synchronizes them. This is usually done with two data/information sources with different languages, as in XML data bin ...
s. WPF runtime libraries are included with all versions of
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
since
Windows Vista Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
and
Windows Server 2008 Windows Server 2008 is the fourth release of the Windows Server operating system produced by Microsoft as part of the Windows NT family of the operating systems. It was released to manufacturing on February 4, 2008, and generally to retail on Fe ...
. Users of
Windows XP Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct upgrade to its predecessors, Windows 2000 for high-end and ...
SP2/SP3 and
Windows Server 2003 Windows Server 2003 is the sixth version of Windows Server operating system produced by Microsoft. It is part of the Windows NT family of operating systems and was released to manufacturing on March 28, 2003 and generally available on April 24, 2 ...
can optionally install the necessary libraries.
Microsoft Silverlight Microsoft Silverlight is a discontinued application framework designed for writing and running rich web applications, similar to Adobe's runtime, Adobe Flash. A plugin for Silverlight is still available for a very small number of browsers. W ...
provided functionality that is mostly a subset of WPF to provide embedded web controls comparable to
Adobe Flash Adobe Flash (formerly Macromedia Flash and FutureSplash) is a multimedia Computing platform, software platform used for production of Flash animation, animations, rich web applications, application software, desktop applications, mobile apps, mo ...
. 3D runtime rendering had been supported in Silverlight since Silverlight 5. At the
Microsoft Connect Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
event on December 4, 2018,
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washing ...
announced releasing WPF as open source project o
GitHub
It is released under the
MIT License The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts only very limited restriction on reuse and has, therefore, high license comp ...
. Windows Presentation Foundation has become available for projects targeting the .NET software framework, however, the system is not cross-platform and is still available only on Windows.


Features


Direct3D

Graphics, including desktop items like windows, are rendered using Direct3D. This allows the display of more complex graphics and custom themes, at the cost of GDI's wider range of support and uniform control theming. It allows Windows to offload some graphics tasks to the
GPU A graphics processing unit (GPU) is a specialized electronic circuit designed to manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mobi ...
. This reduces the workload on the computer's CPU. GPUs are optimized for parallel pixel computations. This tends to speed up screen refreshes at the cost of decreased compatibility in markets where GPUs are not necessarily as powerful, such as the netbook market. WPF's emphasis on vector graphics allows most controls and elements to be scaled without loss in quality or
pixelization Pixelization (British English, pixelisation) or mosaic processing is any technique used in editing images or video, whereby an image is blurred by displaying part or all of it at a markedly lower resolution. It is primarily used for censorshi ...
, thus increasing accessibility. With the exception of Silverlight, Direct3D integration allows for streamlined 3D rendering. In addition, interactive 2D content can be overlaid on 3D surfaces natively.


Data binding

* WPF has a built-in set of data services to enable application developers to bind and manipulate data within applications. It supports four types of data binding: *# one time: where the client ignores updates on the server. *# one way: where the client has read-only access to data. *# two way: where client can read from and write data to the server *# one way to source: where the client has write-only access to data *
LINQ Language Integrated Query (LINQ, pronounced "link") is a Microsoft .NET Framework component that adds native data querying capabilities to .NET languages, originally released as a major part of .NET Framework 3.5 in 2007. LINQ extends the langu ...
queries, including ''LINQ to XML'', can also act as data sources for data binding. * Binding of data has no bearing on its presentation. WPF provides data templates to control presentation of data. * A set of built-in controls is provided as part of WPF, containing items such as button, menu, grids, and list box. * Dependency Properties can be added to Behaviours or Attached Properties to add custom binding properties. * A powerful concept in the WPF is the logical separation of a control from its appearance. ** A control's template can be overridden to completely change its visual appearance. ** A control can contain any other control or layout, allowing for a high degree of control over composition. *Features
retained mode Retained mode in computer graphics is a major pattern of API design in graphics libraries, in which * the graphics library, instead of the client, retains the scene (complete object model of the rendering primitives) to be rendered and * the ...
graphics. Repainting the display isn't always necessary.


Media services

* The WPF provides an integrated system for building user interfaces with common media elements like vector and raster images, audio, and video. WPF also provides an animation system and a 2D/3D rendering system. * WPF provides shape primitives for 2D graphics along with a built-in set of brushes, pens, geometries, and transforms. * The 3D capabilities in WPF are a subset of the full-feature set provided by Direct3D. However, WPF provides tighter integration with other features like user interfaces, documents, and media. This makes it possible to have 3D user interfaces, 3D documents, or 3D media. * There is support for most common image formats: BMP, JPEG, PNG, TIFF, Windows Media Photo, GIF, and ICON. * WPF supports the video formats
WMV Windows Media Video (WMV) is a series of video codecs and their corresponding video coding formats developed by Microsoft. It is part of the Windows Media framework. WMV consists of three distinct codecs: The original video compression technology ...
,
MPEG The Moving Picture Experts Group (MPEG) is an alliance of working groups established jointly by International Organization for Standardization, ISO and International Electrotechnical Commission, IEC that sets standards for media coding, includ ...
and some AVI files by default, but since it has
Windows Media Player Windows Media Player (WMP) is the first media player and media library application that was developed by Microsoft for playing audio, video and viewing images on personal computers running the Microsoft Windows operating system, as well as on ...
running beneath, WPF can use all the codecs installed for it.


Templates

* In WPF you can define the look of an element directly, via its properties, or indirectly with a template or style. At its simplest a style is a combination of property settings that can be applied to a UI element with a single property attribute. Templates are a mechanism for defining alternative UI for portions of your WPF application. There are several template types available in WPF (ControlTemplate, DataTemplate, HierarchicalDataTemplate, and ItemsPanelTemplate). Control templates * Underlying all UI controls in WPF is a new composition model. Every control is composed of one or more ‘visuals’. These visual sub-elements are turned into a hierarchical visual tree by WPF and eventually rendered by the GPU. Because WPF controls are not wrappers for standard Windows controls their UI can be radically changed without affecting the normal behavior of the control. * Every control in WPF has a default ‘template’ that defines its visual tree. The default template is created by the control author and is replaceable by other developers and designers. The substitute UI is placed within a ControlTemplate. Data templates * WPF has a flexible data binding system. UI elements can be populated and synchronized with data from an underlying data model. Rather than showing simple text for the bound data, WPF can apply a data template (replaceable UI for .NET types) before rendering to the visual tree.


Animations

* WPF supports time-based animations, in contrast to the frame-based approach. This decouples the speed of the animation from how the system is performing. * WPF supports low level animation via timers and higher level abstractions of animations via the Animation classes. ** Any WPF element property can be animated as long as it is registered as a dependency property. ** Animation classes are based on the .NET type of property to be animated. For instance, changing the color of an element is done with the ColorAnimation class and animating the width of an element (which is typed as a double) is done with the DoubleAnimation class. * Animations can be grouped into Storyboards. ** Storyboards are the primary way to start, stop, pause and otherwise manipulate the animations. * Animations can be triggered by external events, including user action. * Scene redraws are time triggered. * Presentation timers are initialized and managed by WPF. * Animation effects can be defined on a per-object basis, which can be accessed directly from
XAML Extensible Application Markup Language (XAML ) is a declarative XML-based language that Microsoft developed for initializing structured values and objects. It is available under Microsoft's Open Specification Promise. XAML is used extensively ...
markup.


Imaging

* WPF can natively access
Windows Imaging Component Windows Imaging Component (WIC) is a COM-based imaging codec framework introduced in Windows Vista (and later available in Windows XP Service Pack 3) for working with and processing digital images and image metadata. WIC enables application ...
(WIC) code and APIs allowing developers to write image codecs for their specific image file formats.


Effects

* WPF 3.0 provides for Bitmap effects (BitmapEffect class), which are raster effects applied to a Visual. These raster effects are written in unmanaged code and force rendering of the Visual to be performed on the CPU and not hardware accelerated by the GPU. BitmapEffects were deprecated in .NET 3.5 SP 1. * .NET Framework 3.5 SP1 adds the Effect class, which is a Pixel-Shader 2.0 effect that can be applied to a visual, which allows all rendering to remain on the GPU. * The Effect class is extensible, allowing applications to specify their own shader effects. * The Effect class, in .NET 3.5 SP1 and 4.0, ships with two built-in effects, BlurEffect and DropShadowEffect. There are no direct replacements for OuterGlowBitmapEffect, EmbossBitmapEffect and BevelBitmapEffect, previously provided by the deprecated BitmapEffect class. However, there are other ways of achieving the same results with the Effect class. For example, developers can get an outer glow effect by using the DropShadowEffect with its ShadowDepth set to 0. * Although the BitmapEffect class was marked as deprecated in .Net Framework 3.5 SP1, its use was still allowed and these effects would still render correctly. In .Net Framework 4.0 the BitmapEffect class was effectively deprecated - code referencing BitmapEffect still builds without errors, but no effect gets actually rendered.


Documents

* WPF natively supports paginated documents. It provides the DocumentViewer class, which is for reading fixed layout documents. The FlowDocumentReader class offers different view modes such as per-page or scrollable and also reflows text if the viewing area is resized. * Natively supports
XML Paper Specification Open XML Paper Specification (also referred to as OpenXPS) is an open specification for a page description language and a fixed-document format. Microsoft developed it as the XML Paper Specification (XPS). In June 2009, Ecma International adopte ...
documents. * Supports reading and writing paginated documents using
Open Packaging Conventions The Open Packaging Conventions (OPC) is a container-file technology initially created by Microsoft to store a combination of XML and non-XML files that together form a single entity such as an Open XML Paper Specification (OpenXPS) document. OPC-b ...
.


Text

* WPF includes a number of text rendering features that were not available in
GDI GDI may refer to: Science and technology * Gasoline direct injection, a type of fuel injection * Graphics Device Interface, a component of Microsoft Windows * Guanosine nucleotide dissociation inhibitor, a protein Organisations * Gabriel Dumont I ...
. This is the first Microsoft programming interface to expose
OpenType OpenType is a format for scalable computer fonts. It was built on its predecessor TrueType, retaining TrueType's basic structure and adding many intricate data structures for prescribing typographic behavior. OpenType is a registered trademark ...
features to software developers, supporting OpenType, TrueType, and OpenType CFF (
Compact Font Format PostScript fonts are font files encoded in outline font specifications developed by Adobe Systems for professional digital typesetting. This system uses PostScript file format to encode font information. "PostScript fonts" may also separately ...
) fonts. * Support for OpenType typographic features includes: ** Ligatures ** Old-style numerals (for example, parts of the glyph hang below the text baseline) **
Swash Swash, or forewash in geography, is a turbulence, turbulent layer of water that washes up on the beach after an incoming ocean surface wave, wave has broken. The swash action can move beach materials up and down the beach, which results in the ...
variants ** Fractions ** Superscript and subscript ** Small caps ** Line-level justification **
Ruby character Ruby characters or rubi characters () are small, annotative glosses that are usually placed above or to the right of logographic characters of languages in the East Asian cultural sphere, such as Chinese ''hanzi'', Japanese ''kanji'', and Kore ...
s ** Glyph substitution ** Multiple baselines ** Contextual and Stylistic Alternates **
Kerning In typography, kerning is the process of adjusting the spacing between Character (symbol), characters in a Typeface#Proportion, proportional font, usually to achieve a visually pleasing result. Kerning adjusts the space between individual le ...
* WPF handles texts in
Unicode Unicode, formally The Unicode Standard,The formal version reference is is an information technology Technical standard, standard for the consistent character encoding, encoding, representation, and handling of Character (computing), text expre ...
, and handles texts independent of global settings, such as system locale. In addition, fallback mechanisms are provided to allow writing direction (horizontal versus vertical) handled independent of font name; building international fonts from composite fonts, using a group of single-language fonts; composite fonts embedding. Font linking and font fallback information is stored in a portable XML file, using composite font technology. The XML file has extension '. * The WPF text engine also supports built-in
spell checking In software, a spell checker (or spelling checker or spell check) is a software feature that checks for misspellings in a text file, text. Spell-checking features are often embedded in software or services, such as a word processor, email client, el ...
. It also supports such features as automatic line spacing, enhanced international text, language-guided line breaking,
hyphen The hyphen is a punctuation mark used to join words and to separate syllables of a single word. The use of hyphens is called hyphenation. ''Son-in-law'' is an example of a hyphenated word. The hyphen is sometimes confused with dashes (figure d ...
ation, and justification, bitmap effects, transforms, and text effects such as shadows, blur, glow, rotation etc. Animated text is also supported; this refers to animated glyphs, as well as real-time changes in position, size, color, and opacity of the text. * WPF text rendering takes advantage of advances in
ClearType ClearType is Microsoft's implementation of subpixel rendering technology in rendering text in a font system. ClearType attempts to improve the appearance of text on certain types of computer display screens by sacrificing color fidelity for addit ...
technology, such as sub-pixel positioning, natural advance widths, Y-direction anti-aliasing,
hardware-accelerated Hardware acceleration is the use of computer hardware designed to perform specific functions more efficiently when compared to software running on a general-purpose central processing unit (CPU). Any transformation of data that can be calcul ...
text rendering, as well as aggressive caching of pre-rendered text in video memory. ClearType cannot be turned off in older WPF 3.x applications. Unlike the ClearType in GDI or GDI+, WPF ClearType does not snap glyphs to pixels horizontally, leading to a loss of contrast disliked by some users. The text rendering engine has been rewritten in WPF 4.0, correcting this issue. * The extent to which glyphs are cached is dependent on the video card.
DirectX Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direct", ...
10 cards are able to cache the font glyphs in
video memory Dynamic random-access memory (dynamic RAM or DRAM) is a type of random-access semiconductor memory that stores each bit of data in a memory cell, usually consisting of a tiny capacitor and a transistor, both typically based on metal-oxid ...
, then perform the composition (assembling of character glyphs in the correct order, with the correct spacing), alpha-blending (application of anti-aliasing), and RGB blending (ClearType's sub-pixel color calculations), entirely in hardware. This means that only the original glyphs need to be stored in video memory once per font (Microsoft estimates that this would require 2 MB of video memory per font), and other operations such as the display of anti-aliased text on top of other graphics—including video—can also be done with no computation effort on the part of the CPU. DirectX 9 cards are only able to cache the alpha-blended glyphs in memory, thus requiring the CPU to handle glyph composition and alpha-blending before passing this to the video card. Caching these partially rendered glyphs requires significantly more memory (Microsoft estimates 5 MB per process). Cards that don't support DirectX 9 have no hardware-accelerated text rendering capabilities.


Interoperability

*
Windows Forms Windows Forms (WinForms) is a free and open-source graphical (GUI) class library included as a part of Microsoft .NET, .NET Framework or Mono Framework, providing a platform to write client applications for desktop, laptop, and tablet PCs. While ...
is also possible through the use of the ElementHost and WindowsFormsHost classes. To enable the use of WinForms, the developer executes this from their WPF C# code: System.Windows.Forms.Integration.WindowsFormsHost.EnableWindowsFormsInterop();


Alternative input

* WPF supports digital ink-related functionality. * WPF 4.0 supports multi-touch input on
Windows 7 Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was released to manufacturing on July 22, 2009, and became generally available on October 22, 2009. It is the successor to Windows Vista, released nearly ...
and above.


Accessibility

* WPF supports
Microsoft UI Automation Microsoft UI Automation (UIA) is an application programming interface (API) that allows one to access, identify, and manipulate the user interface (UI) elements of another application. UIA is targeted at providing UI accessibility and it is a suc ...
to allow developers to create accessible interfaces. * This
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
also allows automated test scripts to interact with the UI.


XAML

Following the success of
markup language Markup language refers to a text-encoding system consisting of a set of symbols inserted in a text document to control its structure, formatting, or the relationship between its parts. Markup is often used to control the display of the document ...
s for web development, WPF introduces eXtensible Application Markup Language (
XAML Extensible Application Markup Language (XAML ) is a declarative XML-based language that Microsoft developed for initializing structured values and objects. It is available under Microsoft's Open Specification Promise. XAML is used extensively ...
; ), which is based on
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
. XAML is designed as a more efficient method of developing application user interfaces. The specific advantage that XAML brings to WPF is that XAML is a completely declarative language, allowing the developer (or designer) to describe the behavior and integration of components without the use of
procedural programming Procedural programming is a programming paradigm, derived from imperative programming, based on the concept of the '' procedure call''. Procedures (a type of routine or subroutine) simply contain a series of computational steps to be carrie ...
. Although it is rare that an entire application will be built completely in XAML, the introduction of XAML allows application designers to more effectively contribute to the application development cycle. Using
XAML Extensible Application Markup Language (XAML ) is a declarative XML-based language that Microsoft developed for initializing structured values and objects. It is available under Microsoft's Open Specification Promise. XAML is used extensively ...
to develop user interfaces also allows for separation of model and view, which is considered a good architectural principle. In XAML, elements and attributes map to classes and properties in the underlying APIs. As in web development, both layouts and specific themes are well suited to markup, but
XAML Extensible Application Markup Language (XAML ) is a declarative XML-based language that Microsoft developed for initializing structured values and objects. It is available under Microsoft's Open Specification Promise. XAML is used extensively ...
is not required for either. Indeed, all elements of WPF may be coded in a .NET language ( C#,
VB.NET Visual Basic, originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visua ...
). The XAML code can ultimately be compiled into a managed assembly in the same way all .NET languages are.


Architecture

The architecture of WPF spans both
managed code Managed code is computer program code that requires and will execute only under the management of a Common Language Infrastructure (CLI); Virtual Execution System (VES); virtual machine, e.g. .NET, CoreFX, or .NET Framework; Common Language Runt ...
and
native code In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ver ...
components. However, the public
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
exposed is only available via managed code. While the majority of WPF is in managed code, the composition engine which renders the WPF applications is a native component. It is named Media Integration Layer (MIL) and resides in milcore.dll. It interfaces directly with
DirectX Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direct", ...
and provides basic support for 2D and 3D surfaces, timer-controlled manipulation of contents of a surface with a view to exposing animation constructs at a higher level, and
compositing Compositing is the process or technique of combining visual elements from separate sources into single images, often to create the illusion that all those elements are parts of the same scene. Live action, Live-action shooting for compositing is ...
the individual elements of a WPF application into a final 3D "scene" that represents the UI of the application and renders it to the screen. The
Desktop Window Manager Desktop Window Manager (DWM, previously Desktop Compositing Engine or DCE) is the compositing window manager in Microsoft Windows since Windows Vista that enables the use of hardware acceleration to render the graphical user interface of Windows ...
also uses the MIL for desktop and window composition. The media codecs are also implemented in unmanaged code, and are shipped as windowscodecs.dll. In the managed world, 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 exposes a property system for objects which inherit from DependencyObject, that is aware of the dependencies between the consumers of the property, and can trigger actions based on changes in properties. Properties can be either hard coded values or expressions, which are specific expressions that evaluate to a result. In the initial release, however, the set of expressions supported is closed. The value of the properties can be inherited from parent objects as well. WPF properties support ''change notifications'', which invoke bound
behaviors Behavior (American English) or behaviour (British English) is the range of actions and mannerisms made by individuals, organisms, systems or artificial entities in some environment. These systems can include other systems or organisms as wel ...
whenever some property of some element is changed. Custom behaviors can be used to propagate a property change notification across a set of WPF objects. This is used by the layout system to trigger a recalculation of the layout on property-changes, thus exposing a
declarative programming In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow. Many languages that ap ...
style for WPF, whereby almost everything, from setting colors and positions to animating elements can be achieved by setting properties. This allows WPF applications to be written in
XAML Extensible Application Markup Language (XAML ) is a declarative XML-based language that Microsoft developed for initializing structured values and objects. It is available under Microsoft's Open Specification Promise. XAML is used extensively ...
, which is a declarative mark-up language, by binding the keywords and attributes directly to WPF classes and properties. The interface elements of a WPF application are maintained as a class of Visual objects. Visual objects provide a managed interface to a ''composition tree'' which is maintained by Media Integration Layer (MIL). Each element of WPF creates and adds one or more ''composition nodes'' to the tree. The composition nodes contain rendering instructions, such as clipping and transformation instructions, along with other visual attributes. Thus the entire application is represented as a collection of composition nodes, which are stored in a buffer in the system memory. Periodically, MIL walks the tree and executes the rendering instructions in each node, thus compositing each element on to a DirectX surface, which is then rendered on screen. MIL uses the
painter's algorithm The painter’s algorithm (also depth-sort algorithm and priority fill) is an algorithm for visible surface determination in 3D computer graphics that works on a polygon-by-polygon basis rather than a pixel-by-pixel, row by row, or area by are ...
, where all the components are rendered from back of the screen to the front, which allows complex effects like transparencies to be easily achieved. This rendering process is hardware accelerated using the GPU. The composition tree is cached by MIL, creating a retained mode graphics, so that any changes to the composition tree needs only to be incrementally communicated to MIL. This also frees the applications of managing repainting the screen; MIL can do that itself as it has all the information necessary. Animations can be implemented as time-triggered changes to the composition tree. On the user visible side, animations are specified declaratively, by setting some animation effect to some element via a property and specifying the duration. The
code-behind ASP.NET Web Forms is a web application framework and one of several programming models supported by the Microsoft ASP.NET technology. Web Forms applications can be written in any programming language which supports the Common Language Runtime, s ...
updates the specific nodes of the tree, via Visual objects, to represent both the intermediate states at specified time intervals as well as the final state of the element. MIL will render the changes to the element automatically. All WPF applications start with two threads: one for managing the UI and another background thread for handling rendering and repainting. Rendering and repainting is managed by WPF itself, without any developer intervention. The UI thread houses the Dispatcher (via an instance of DispatcherObject), which maintains a queue of UI operations that need to be performed (as a tree of Visual objects), sorted by priority. UI events, including changing a property that affects the layout, and user interaction events raised are queued up in the dispatcher, which invokes the handlers for the events. Microsoft recommends that the event handlers only update the properties to reflect new content for application responsiveness, with the new content being generated or retrieved in a background thread. The render thread picks up a copy of the visual tree and walks the tree calculating which components will be visible and renders them to Direct3D surfaces. The render thread also caches the visual tree, so only changes to the tree need to be communicated, which will result in updating just the changed pixels. WPF supports an extensible layout model. Layout is divided into two phases: ''Measure''; and ''Arrange''. The ''Measure'' phase recursively calls all elements and determines the size they will take. In the ''Arrange'' phase, the child elements are recursively arranged by their parents, invoking the layout algorithm of the layout module in use.


Tools

A number of development tools are available for developing Windows Presentation Foundation applications.


Microsoft tools

*
Microsoft Visual Studio Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such a ...
is a developer-oriented IDE that contains a combination XAML editor and WPF visual designer, beginning with Visual Studio 2008. * Prior to Visual Studio 2008, the WPF designer add-in, codenamed Cider, was the original release of a WYSIWYG editor for creating WPF windows, pages, and user controls. It was available for Visual Studio 2005 as a ''Visual Studio 2005 extensions for .NET Framework 3.0 CTP'' for the initial release of WPF. *
Microsoft Visual Studio Express Microsoft Visual Studio Express is a set of integrated development environments (IDEs) that Microsoft developed and released free of charge. They are function-limited version of the non-free Visual Studio and require mandatory registration. Exp ...
2008 and later editions, particularly Visual C# Express and Visual Basic Express, also have the WPF designer integrated. *
Microsoft Blend Microsoft Blend for Visual Studio (formerly Microsoft Expression Blend) is a User interface builder, user interface design tool developed and sold by Microsoft for creating graphical interfaces for web and desktop applications that blend the feat ...
is a designer-oriented tool that provides an artboard for the creation of WPF applications with 2D and 3D graphics, text and forms content. It generates
XAML Extensible Application Markup Language (XAML ) is a declarative XML-based language that Microsoft developed for initializing structured values and objects. It is available under Microsoft's Open Specification Promise. XAML is used extensively ...
that may be exported into other tools and shares solution (sln files) and project formats (csproj, vbproj) with Microsoft Visual Studio. *
Microsoft Expression Design Microsoft Expression Design was Microsoft's commercial professional illustration vector and raster graphic design tool for web images based on Creature House Expression, which was acquired by Microsoft in 2003. It is available free of charge fro ...
is a bitmap and 2D-vector graphics tool for exporting to
XAML Extensible Application Markup Language (XAML ) is a declarative XML-based language that Microsoft developed for initializing structured values and objects. It is available under Microsoft's Open Specification Promise. XAML is used extensively ...
. * XAMLPad is a lightweight tool included in the .NET Framework SDK. It can create and render XAML files using a split screen UI layout. It also provides a tree view of the markup in a panel.


Third-party tools

*
SharpDevelop SharpDevelop (also styled as #develop) is a discontinued free and open source integrated development environment (IDE) for the .NET Framework, Mono, Gtk# and Glade# platforms. It supports development in C#, Visual Basic .NET, Boo, F#, IronPyt ...
, an open-source .NET IDE, includes WPF application design abilities. It is a free alternative to Visual Studio. * PowerBuilder .NET by Sybase is a 4GL tool that translates PowerBuilder code, graphical objects to XAML and allows deploying the application as a WPF target.
Essential Studio for WPF
by Syncfusion is a package of over 100 modern WPF UI controls for building beautiful, high performance line-of-business WPF applications.


Deployment

WPF's deployment model offers both standalone and XAML Browser Applications (XBAP, pronounced "ex-bap") flavors. The programming model for building either type of application is similar. Standalone applications are those that have been locally installed on the computer using software such as
ClickOnce ClickOnce is a component of Microsoft .NET Framework 2.0 and later, and supports deploying applications made with Windows Forms or Windows Presentation Foundation. It is similar to Java Web Start for the Java Platform or Zero Install for Linux. ...
or
Windows Installer Windows Installer (msiexec.exe, previously known as Microsoft Installer, codename Darwin) is a software component and application programming interface (API) of Microsoft Windows used for the installation, maintenance, and removal of software. ...
(MSI) and which run on the desktop. Standalone applications are considered ''full trust'' and have full access to a computer's resources.
XAML Browser Applications XAML Browser Applications (XBAP, pronounced "ex-bap") are Windows Presentation Foundation (.xbap) applications that are hosted and run inside a web browser such as Firefox or Internet Explorer. Hosted applications run in a partial trust sandbox en ...
(
XBAP XAML Browser Applications (XBAP, pronounced "ex-bap") are Windows Presentation Foundation (.xbap) applications that are hosted and run inside a web browser such as Firefox or Internet Explorer. Hosted applications run in a partial trust sandbox en ...
s) are programs that are hosted inside a
web browser A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used on ...
. Pre-.NET4 XBAP applications run in a ''partial trust'' sandbox environment, and are not given full access to the computer's resources and not all WPF functionality is available. The hosted environment is intended to protect the computer from malicious applications. XBAPs can run as fully trusted applications in .NET 4, with full access to computer resources. Starting an XBAP from an HTML page or vice versa is seamless (there is no security or installation prompt). Although one gets the perception of the application running in the browser, it actually runs in an out-of-process executable different from the browser.


Internet Explorer

As of the release of .NET Framework 3.0, XBAPs would only run in IE.


Firefox support

With the release of .NET Framework 3.5 SP1, XBAP also runs in Mozilla Firefox using the included extension. On October 16, 2009, Mozilla added the Firefox plugin and extension to its add-ons blocklist, because of a remotely exploitable serious security vulnerability, in agreement with Microsoft. Two days later, the block was removed. On Windows 7, the Firefox plugin does not run by default. A reinstallation of the .NET Framework 3.5 SP1 will install the plugin and add support for XBAP applications on Firefox. Alternatively, hard-copying the plugin DLLs from a working Windows XP/Vista installation to the plugin directory of Mozilla Firefox will also reinstate support for XBAP applications. The WPF plugin DLLs reside in the following directories (depending on the Framework version): ; 3.5 P1: C:\Windows\Microsoft.NET\Framework\v3.5\WPF\NPWPF.dll ; 4.0 : C:\Windows\Microsoft.NET\Framework\WPF\NPWPF.dll


Microsoft Silverlight

Silverlight (codenamed WPF/E) is a deprecated cross-browser
browser plugin A browser extension is a small software module for customizing a web browser. Browsers typically allow a variety of extensions, including user interface modifications, HTTP cookie, cookie management, ad blocking, and the custom userscript, scriptin ...
which contained WPF-based technology (including XAML) that provided features such as video, vector graphics, and animations to multiple operating systems including
Windows 7 Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was released to manufacturing on July 22, 2009, and became generally available on October 22, 2009. It is the successor to Windows Vista, released nearly ...
,
Windows Vista Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
,
Windows XP Windows XP is a major release of Microsoft's Windows NT operating system. It was released to manufacturing on August 24, 2001, and later to retail on October 25, 2001. It is a direct upgrade to its predecessors, Windows 2000 for high-end and ...
, and
Mac OS X macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac (computer), Mac computers. Within the market of ...
. Microsoft sanctioned a limited number of third-party developers to work on ports for certain
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
distributions. Specifically, it was provided as an add-on for Mozilla Firefox,
Internet Explorer 6 Microsoft Internet Explorer 6 (IE6) is a graphical web browser developed by Microsoft for Windows operating systems. Released on August 24, 2001, it is the sixth, and by now discontinued, version of Internet Explorer and the successor to Internet ...
and above,
Google Chrome Google Chrome is a cross-platform web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS ...
42 and below and
Apple Safari Safari is a web browser developed by Apple. It is built into macOS, iOS, and iPadOS, and uses Apple's open-source browser engine, WebKit, which was derived from KHTML. Safari was introduced in Mac OS X Panther in January 2003. It was inclu ...
.


.NET Micro Framework

The
.NET Micro Framework The .NET Micro Framework (NETMF) is a .NET Framework platform for resource-constrained devices with at least 512  kB of flash and 256 kB of random-access memory (RAM). It includes a small version of the .NET Common Language Runtime (CLR ...
includes a GUI object model loosely based on WPF, although without support for XAML.


References


Bibliography

* Adam Nathan: ''Windows Presentation Foundation Unleashed (WPF)'', December 21, 2006, Sams Publishing, *
Chris Anderson Chris Anderson may refer to: Sports * Chris Anderson (baseball) (born 1992), American baseball player * Chris Anderson (cheese roller), 22-time winner of annual cheese rolling * Chris Anderson (footballer, born 1925) (1925–1986), Scottish footb ...
: ''Essential Windows Presentation Foundation (WPF)'', April 11, 2007, Addison-Wesley, * Chris Sells, Ian Griffiths: ''Programming WPF'', August 28, 2007, O'Reilly Media, * Arlen Feldman, Maxx Daymon: ''WPF in Action with Visual Studio 2008'', November 21, 2008, Manning Publications,


External links


MSDN Library: Windows Presentation Foundation

Rich typography with Windows Presentation Foundation

Windows Presentation Foundation User Education
{{Widget toolkits .NET terminology Formerly proprietary software Free and open-source software Presentation Foundation Microsoft free software Microsoft Windows multimedia technology Software using the MIT license Widget toolkits 2006 software Windows-only free software