Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 27

.Net 3.

0 and Windows Presentation Foundation


Jim Fawcett CSE775 Distributed Objects Spring 2007

References

Introducing Windows Presentation Foundation, David Chappell, http://msdn2.microsoft.com/enus/library/aa663364.aspx


Several figures used from this presentation

Introducing Windows Communication Foundation, David Chappell, http://www.davidchappell.com/IntroducingWCFv1.2.1.pdf


Several figures used from this presentation

Foundations of Windows Presentation Foundation, Laurence Moroney, Apress, 2006


Scalable Vector Graphics (SVG), XML Graphics for the Web, http://www.w3.org/Graphics/SVG/

References

Introduction to Vector Markup Language (VML), http://msdn.microsoft.com/library/default.asp?url=/workshop/ author/vml/default.asp


Windows Presentation Foundation, Ronnie Saurenmann, www.00001001.ch/Download/WebSummit/WPF.ppt Windows Presentation Foundation, Sue Chard, www.devlab.ac.nz/dotnetlink/wpf.ppt

.Net 3.0

The .Net 3.0 Framework has support for three major pieces, available for Vista, XP, and Server 2003:
Windows Work Flow (WF) Windows Communication Foundation (WCF) Windows Presentation Foundation (WPF)

There is a fourth piece, Media Foundation, available only on Vista


A COM multi-media framework, designed to replace DirectShow, Windows Media SDK, DirectX media, etc. Wont be available on XP.

Basic tools (command line compilers etc) and Framework classes support these.
New, more productive, tools are coming with the Orcas release of Visual Studio, later this year.

Windows Work Flow (WF)

Windows Work Flow is:


An execution engine for code-based activities Essentially an attempt at simplifying organization of programs. Executes activity blocks and sequences between blocks based on connectivity and control constructs, or based on events. Runs in two modes:

Sequential is essentially a flow-chart execution engine State is a state-machine execution engine

Discussion Ive read indicates that it is oriented primarily toward implementing Business Rules.

Workflows are programmed in XAML (used to be called XOML in WF. The O stood for Object.

All diagrams from Chappell, IWPF

Windows Communication Foundation

Convergence of application programming models for communication, supporting:


Web Services (Asp Web Services) Web Applications (Asp.Net) Windows Services (NT Services) Remoting (.Net Remoting) Queuing (MSMQ)

Can be hosted in:


IIS Windows Services Windows Applications

WCF Services
Chappell (IWCF)

Windows Presentation Foundation

Convergence of presentation programming models, Supporting: Desktop applications


WinForms, MFC, WTL, Win32

Web applications
Asp.Net

Document presentation
Word Documents

Chappell (IWPF)

Chappell (IWPF)

Elements of WPF

Scalable Vector Graphics


It is not clear whether WPF is based on standard SVG or on Microsofts proprietary Vector Markup Language (VML)

eXtensible Application Markup Lanaguage (XAML)


A dilect of XML with tags defined for specific graphics (or other application) operations:
<Rectangle Width="30" Height="10" Fill="HorizontalGradient Red Yellow" />

CodeBehind
Event handler code

Applications
Controls Styling Layout Data Content Action

Presentation Framework

Adapted from Chard (WPF)

PresentationCore.dll - managed MilCore.dll unmanaged composition DirectX a COM technology

Driver

Features

Programming
Declarative programming with XAML Imperative programming with classes from System.Windows namespace

Interop with Forms


Host Forms controls on WPF pages Host WPF controls on Forms

WPF Support for Presentation

Presentation mode:
Layout:

Window: basic display windows NavigationWindow: hyperlinked navigation DockPanel: Flow layout like a web page StackPanel: Linear layout, ala toolbars Grid: Absolute positioning on grid Canvas: Free positioned layout

Controls:

All the usual plus new addtions Supports custom controls

Styles

Cascading Style Sheets


It is not clear that WPF directly supports CSS WPF does have DataTemplate and ControlTemplate classes that support styling data layouts and controls.

Style element class:


<style></style>

Inline styles:
<Button style={StaticResource ButtonStyle}>a title</Button>

Documents

Typography:

Documents

OpenType fonts ClearType Glyphs FixedDocument class FlowDocument class

Layout is fixed for rendering in any window or printer, does not flow

Lots of control over the details of how that is done through properties

Uses browser flow model

Media

Images
<Image width=200 Source=C:\temp\us.jpg /> Can have metadata Can be painted onto 3D canvases

Video
<MediaElement Source=c:\temp\myVid.wmv /> Handles wmv, mpeg, avi, wav,

Audio & Video

Ronnie Saurenmann (WPF)

<Border Width="400" BorderBrush="Green" BorderThickness="9"> <StackPanel> <MediaElement Source="aero.wmv" /> <Button>Hello</Button> </StackPanel> </Border>

Formats: WMV, MPEG, Some AVIs Can be synchronized with animations Windows Media Foundation used to instantiate playback machinery into a DirectShow graph

2D Graphics

Support for primitives:


Line, Ellipse, Rectangle, Polygon, Polyline, Path Support for defining regions:

LineGeometry, RectangleGeometry,

2D Graphics, 3D Graphics, Imaging


Ronnie Saurenmann (WPF)

3D Graphics

3D Graphics

Viewport3D control Models


Define shape, lighting, viewing

GeometryModel3D class SpecularMaterial class DiffuseMaterial class DirectionalLight AmbientLight PerspectiveCamera OrthographicCamera

Transformations

RotateTransform ScaleTransform RenderTransform Blur and glow effects

Animations

Storyboard class
Defines element(s) to which animation applies, by name Initial properties like size and position Range of changes of those properties with duration settings (time between changes)

Combining Stuff

Most of the WPF elements can be containers:


Can put an ellipse in a button

Graphics figures, controls, animations, can be freely mixed and applied to each other.

Applications

Desktop applications
Full trust Rich, but familiar applications

XAML Browser Applications (XBAPS)


Lowered trust

Many operations are not allowed, e.g., access to local file system

May appear very like an equivalent desktop application Most of the code is the same

End of Presenation

You might also like