wpf under the hood engines

26
WPF Under The Hood Engines Tamir Khason Software consulter mPrest systems [email protected] http://blogs.microsoft.co.il/blogs/tamir

Upload: tamir-khason

Post on 17-Jul-2015

1.829 views

Category:

Technology


2 download

TRANSCRIPT

WPF Under The HoodEngines

Tamir KhasonSoftware consultermPrest [email protected]://blogs.microsoft.co.il/blogs/tamir

Agenda

• What is Windows Presentation Foundation?• New age of real world applications• WPF properties system• WPF data binding• WPF visualization engine• Expression Blend / Sparkle

What is Windows Presentation Foundation?• It’s part of WinFX (.NET 3.0)• It’s XAML (just like [HT]ML) and .NET 2.0• It’s a unified approach to code, UI, documents

and media• It’s not HWND• It runs in Windows (XP too), Web and even /E• It works mostly using the GPU

So XAML or Code

>Button Width ="100"Background="LightBlue">OK>/Button>

Button b = new;()Button ;b.Width = 100

;b.Background = Brushes.LightBlue b.Content =;""OK

Dim b As New Button b.Width = 100

b.Background = Brushes.LightBlue b.Content =""OK

Compile and RunCompile and Run

Compile and RunCompile and Run

ParseParse010010100100100101001011010010101110100101010110101010001101010100

BAMLBAML

Load and DisplayLoad and Display

… or Both

>Button Width ="100"Background ="LightBlue"Click="DoSomething">OK>/Button>

void DoSomething(object sender,} (RoutedEventArgs e MessageBox.Show( "I do not have to do designer's

{ ;("!work

CLASSCLASS

Compile and RunCompile and Run

public partial class ;internal Button b ;(“Load(“app.baml;(“Load(“app.baml

010010100101101001010010110100101010110010010101011010101001010100

app.bamlapp.baml

Parse and GenerateParse and Generate

WPF architecture

PropertyEngine

Input / EventingSystem

NET Framework 2.0.

Desktop Windows Manager

Media Integration Layer

DirectX

(Windows Vista Display Driver (LDDM

Windows MediaFoundation

CompositionEngine

Print Spooler

ManagedUnmanaged

ApplicationServices

DeploymentServices

Databinding

USER INTERFACE SERVICES

XAML

Accessibility

Property System

Input & Eventing

BASE SERVICES

DOCUMENT SERVICES

Packaging Services

XPS Documents

Animation

2D

3D

AudioImaging

Text

VideoEffects

Composition Engine

MEDIA INTEGRATION LAYER

Controls

Layout

Win

dow

s Pr

esen

tatio

n Fo

unda

tion

XPS

Vie

wer

New age of real world applications

LET’S DO IT!New age of real world applications

Dependency and Attached Properties

PropertyEngine

Input / EventingSystem

NET Framework 2.0.

Unmanaged

USER INTERFACE SERVICES

Property System

Input & Eventing

BASE SERVICES

DOCUMENT SERVICES

MEDIA INTEGRATION LAYER

• Dependency Property– Globally registered static property– Handles storage and property

changes– Implement a dependency

properties when visual or logical inheritance, or invalidation is required

• Attached Property– Specialized form of dependency

properties– Child elements store unique values

on parent Child informs parent how to present it on the UI

– If parent not found, attached property is ignored

DEPENDENCY AND ATTACHED PROPERTIESWPF Properties Systems – base concepts

Data Binding

• UI can be bound to any data driven object

• Dependency properties can be even bounded to ADO.NET and Web Services

• All operations (filter, sort, group) are generated on top of the data

• You can apply Data Templates to the data

Binding Target Binding Source

Dependency ObjectDependency Object ObjectObject

DependencyProperty

PropertyTwoWay

OneWay

OneWayToSource

• What can be a data binding target– Any FrameworkElement– Any DependencyProperty

DATA BINDINGWPF Data Binding

Visualization engine and StylingUSER INTERFACE SERVICES

XAML

BASE SERVICES

DOCUMENT SERVICES

Composition Engine

MEDIA INTEGRATION LAYER

Controls

Layout

• Dependency Properties = binding, styling, triggers, animation

• Template = customized experience

• Removed explicit relationship between code & UI

• Empowered application designer to create custom visuals

STYLES, TEMPLATES, SKINS AND THEMESWPF visualization engine

LET DESIGNERS DO THEIR WORKExpression Blend / Sparkle

Come to meet me at the Come to meet me at the Development Panel, mail meDevelopment Panel, mail me

[email protected]@khason.biz or visit my blog: or visit my blog:

http://blogs.microsoft.co.il/blogs/tamirhttp://blogs.microsoft.co.il/blogs/tamir

2iMATE JASJAM – סלולרי חכם משולב כף יד דורבחסות חברת סולגוד יוגרלו בין כל ממלאי3.5

!המשוביםעכבר אלחוטיים יוגרלו בכל אולם-סט מקלדת

! בהרצאה האחרונה....)לא לשכוח למלא משוב מסכם)

Thanks giving• Many thanks to Cian Walsh from Afterglow Design (

www.afterglow.ie) for icons• Thanks to PYImage for application layout• Thanks to Big Bill for his song “How you want it done”• Thanks to Microsoft for their Foundations (

www.netfx3.com) • Thank you for your patience!

Go build your own application easily with WPF