Friday, September 5, 2008

INTRODUCTION TO THE WPF Section1


What is WPF

WPF is the engine or set of libraries that is responsible for creating, displaying, build, run, execute, and manipulating user-interfaces, documents, images, movies, and media in Windows Platform.

Windows Presentation Foundation (hereafter referred to as WPF) is a new API for creating graphical user interfaces for the Windows platform.

Use a single WPF programming model to write code once and deploy it as a standalone installed application or in a browser.


What Operating Systems does WPF support

Windows Vista, Windows XP, and Windows 2003 Server.


WPF Fundamentals

WPF Fundamentals support the overall programming model. These include features that extend CLR concepts like properties, events, input, commanding and other programming model features like styles, templates, threading, resources, and working with an element tree.


WPFfeatures

1) Client Profile enables faster redistribution with a smaller download

2) 2D and 3D graphics and hardware accelerated effects

3) Common file format (XAML) allowing designers and developers to collaborate

4) Scalability to different form factors

5) Controls, data binding and extensibility enable developers to quickly build high fidelity applications


What is XAML

XAML-the extensible Application markup language- is an xml based language for creating trees of .net objects.

XAML is a new descriptive programming language developed by Microsoft to write user interfaces for next generation managed applications.

WPF Inline Code using XAML.



WPF Architecture




The above diagram explains the WPF architecture. At the lower most level we have the Kernel , your graphics drivers etc… on top of it we have 2 modules.

1)USER32

2)Direct3D


USER32

USER32 is responsible for deciding what window goes where on your screen. So each window gets its allocated space by this USER32


Direct3D

Direct3D is responsible for rendering the content of each of these windows. Direct3D talks to the graphics drivers and sets the pixels on the monitor.


milcore.dll.- MIL(Media Integration Library)

On top of Direct3D, the WPF team built milcore.dll.- MIL is Media Integration Library.

This is an unmanaged module and is basically the composition engine that’s providing features like 2D, 3D, animation etc… Its the one that directly communicates to Direct3D


WindCodecs.dll

It is middle man between the WPF and Direct3D.

WindCodecs.dll is unmanaged implementation of various imaging codecs like png, jpeg etc…


NET 3.0 Common Language Runtime

CLR manage the execution environment .It provide the JIT(Just in Time Compiler)


PresentationCore

Above .NET 3.0 Common Language Runtime layer is the PresentationCore which is a mix of managed and unmanaged code.

This is a low level API exposed by WPF providing features for 2D, 3D, Geometry etc…


PresentationFramework

Above PresentationCore layer is the PresentationFramework .

It provides access to high level features like applications, controls, styles etc.. Also we have access to layouts, data, content and actions which help you build up your entire application.

PresentationFramework

Above PresentationCore layer is the PresentationFramework .


Application Development Overview

Windows Presentation Foundation (WPF) supports the creation of the following types of applications:

1) Standalone Applications (traditional style Windows applications built as executable assemblies that are installed to and run from the client machine).

2) XAML browser applications (XBAPs) (applications composed of navigable pages that are built as executable assemblies that are browsed to and hosted by Windows Internet Explorer).

3) Custom Control Libraries (non-executable assemblies containing reusable controls).

4) Class Libraries (non-executable assemblies that contain reusable classes).



WPF Applications Models








WPF has two main applications models: standalone and browser.

1)standalone

When we want to create a “traditional” Windows application, we should choose to create “Windows Application (WPF)”.




Users interact with Windows Presentation Foundation (WPF) standalone applications through windows. The primary purpose of a window is to host content that visualizes data and enables users to interact with data.

Standalone WPF applications provide their own windows by using the windows class.

2) browser

When we want to create a XAML Browser Application , we should choose new “XAML Browser Application (WPF)”



How do We build and run WPF Applications?

To build and run WPF application, we must install .NET 3.0 SDK.



Building a WPF Application





Windows Presentation Foundation (WPF) applications can be built as .NET Framework executables (.exe), libraries (.dll), or a combination of both types of assemblies.

Command-line compilation can be used to build applications with more complexity, although the compiler does not support WPF applications that include Extensible Application Markup Language (XAML) source code. Furthermore, command-line compilation does not support the full range of build requirements of typical WPF applications, including configuration management and ClickOnce manifest generation. To support these and other more complex build requirements, WPF integrates with and extends MSBuild.

To build a project in Visual Studio, right-click the project in the Solution Explorer window and choose Build.

Building a Solution in Visual Studio

To build a solution, do any of the following:

1) Press F6 to build the solution.

2) Press F5 to start debugging the solution.

3) Choose Build | Build Solution.

4) Choose Debug | Start Debugging.

5) Choose Debug | Start Without Debugging.

Doing any of these for either a project or a solution causes Visual Studio to execute msbuild.exe to build the appropriate MSBuild files.



No comments: