introduction to wpf engines

33
Tamir Khason Software consulter mPrest systems [email protected] http://blogs.microsoft.co.il/blogs/tamir 05/23/22 1 © 2001-2007 Copyright Microsoft corporation

Upload: tamir-khason

Post on 24-May-2015

760 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Introduction To Wpf   Engines

Tamir KhasonSoftware consultermPrest systems

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

04/12/23 1© 2001-2007 Copyright Microsoft corporation

Page 2: Introduction To Wpf   Engines

Agenda

WTF1 is WPF WTF2 Inside there WTF3 XAML WTF4 WPF Engines WTF5 Expression

1 - Work Time Fun2 - Write To File3 - What's This For4 - Words That Follow5 - Way to Fly

Page 3: Introduction To Wpf   Engines

Windows Presentation Foundation WPF is much richer then WinForms XAML is cool and prevents the mess with

crazy designers We do not really need User Controls and

Owner Draws We can forget about input and output

hardware We want all properties to be DPs and all

events to be REs It’s all about data

Page 4: Introduction To Wpf   Engines

No demos – don’t you already use it in your developments?

Page 5: Introduction To Wpf   Engines

Platforms?

Windows XP Home/Pro SP2

Windows Server 2003

Windows Vista

Page 6: Introduction To Wpf   Engines

What about all things done? Can use WPF with existing code

WPF inside existing code Existing code inside WPF

Interop at the component level

Maximum richness => all WPF

Page 7: Introduction To Wpf   Engines

Engines involved

WTF2 Inside there

Page 8: Introduction To Wpf   Engines

How to design your application WPF controls are lookless – it’s all about data Objects creation through properties drives

behaviors WPF is dynamic, sometimes too much First create data, then let designer to

present it

Prop-erties

CustomDraw

Owner Draw or Custom Control

Pay for P lay Customization:Rich Content, Visual Styling, Built for a new Platform

Prop-erties

Custom Control

Page 9: Introduction To Wpf   Engines

WPF fundamentals

Basic Architecture

XAML Layout Controls

Page 10: Introduction To Wpf   Engines

Content model

There are only two framework elements: Content and Behavior Containers of Content and Behavior

Content element contains any kind of content via Content property

Item element contains any number of Content Elements via Items property and pointer to current element

Page 11: Introduction To Wpf   Engines

Layout model

WPF has only one panel, but different behaviors for this one

Panel behavior is an implementation a control layout

You have some ready made and can create your own

There are some layout models Children, Size to Content, Alignments,

Margins and Overflows

Page 12: Introduction To Wpf   Engines

Layout - Panels

Page 13: Introduction To Wpf   Engines

Dependency Property

Calculating of property's value based on other properties

Dependency property is… Static fields, registered with meta data CLR property

Attached property is a dependency property that defined by a different type than the element to which the property is applied

Page 14: Introduction To Wpf   Engines

eXtensible Application Markup Language

WTF3 XAML

Page 15: Introduction To Wpf   Engines

XAML defines a tree of stateful objects

<TravelItenerary> <CarTrip

From="Aix en Provence, France" To="Paris, France"

Time="2006/07/20T12:00"Duration="6:00:00" />

<HotelName="Under the Eiffel Tower"Location="Paris, France"Time="2006/07/20T20:00"CheckOut="2006/07/21T05:00" />

<FlightFrom="Paris, France" To="London,

England"Time="2006/07/21T7:00"Duration="1:15:00" />

<FlightFrom="London, England"To="Seattle, USA"Time="2006/07/21T16:15"Duration="9:30:00" />

</TravelItenerary>

Page 16: Introduction To Wpf   Engines

XAML uses namespaces for extensions - xmlns:… Markup Extensions

Used in Attribute Values to set values that aren't settable via type converters

XAML Language {x:Null} {x:Static Class.Member} {x:Type wpf:Button}

WPF Class Library {Binding …}, {StaticResource …},

{DynamicResource …}, etc…

Page 17: Introduction To Wpf   Engines

How they make our live easier?

WTF4 WPF Engines

Page 18: Introduction To Wpf   Engines

Routed Events

Nothing new, but nice refreshment – regular .NET events extension

Can be created, changed and called Can have one of following strategies

Direct Bubbling Tunneling

Page 19: Introduction To Wpf   Engines

Commands

Command = Action Command != Action logic Can be executed from different

places Can have different behaviors for

different targets You have some ready made and can

create your own Can have constraints

Page 20: Introduction To Wpf   Engines

Data Binding

WPF understands your data use your favorite data model: XML,

objects, SQL, WS … Bind data to controls

Templates give your data a face

Controls “think” data Data is pervasive across and integrated

into the platform

Page 21: Introduction To Wpf   Engines

Data Binding

Target Any property, any element

Source CLR Object WPF Element ADO.NET XML

Dynamic INotifyPropertyChanged, DependencyProperty or

PropertyDescriptor Multiple models

One Time One Way Two Way

Value Converter

Control

“Data Item” Property

Binding

Pro

perty

Page 22: Introduction To Wpf   Engines

Styles

A style is a way to change visual representation of control, by using a set of properties

Styles make your application to looks fun, without changing its logic

The separation of the presentation and logic allows designers and programmers to work simultaneously

Page 23: Introduction To Wpf   Engines

Templates

Templates are not styles, but might include

Templates is the way to change control’s behaviors

Templates is the way to change data representation

Templates are resources, thus might be loaded externally

Page 24: Introduction To Wpf   Engines

Control Templates

Controls have separated appearance and behavior

Control template = way to change behavior

Control appearance is the Cheshire Cat and set by styles  

You do not need custom controls, unless you have something new to do

Page 25: Introduction To Wpf   Engines

Data Templates

Make you data visible Data Template is the way to

definevisual structure of a data object

Data Template useable aside with binding

Don’t build views for displaying data, let the data to build the view

Might be recursive

Page 26: Introduction To Wpf   Engines

What’s going on over designer’s scheme?

WTF5 Expression

Page 27: Introduction To Wpf   Engines

Expression Blend

Expression Blend is a design tool Expression Blend provides tools for

Vector and bitmap based graphics 3D, Animation Rich Controls, Text Documents and more.

Share results with Developers who use Visual Studio to add C# or VB code and assemble the final experience.

Page 28: Introduction To Wpf   Engines
Page 29: Introduction To Wpf   Engines

Expression Design

Expression Design is even more design tool

Expression Design provides tools for Professional and highly creative vector

drawing Transformation and effect features An reliable XAML Exporter to convert design

elements into XAML Share results with Designer who use

Expression Blend to add elements into layout and final markup

Page 30: Introduction To Wpf   Engines
Page 31: Introduction To Wpf   Engines

Expression Media and Web

Expression Web Build websites using XHTML, ASP.NET,

CSS, XML, etc. Expression Media

Digital Asset Management and Cataloguing tool for arrangement of large amount of rich media types into logical categories.

Expression Studio contains of them all

Page 32: Introduction To Wpf   Engines

WTFn - Where's the Food?

Page 33: Introduction To Wpf   Engines

© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 04/12/23 33© 2001-2007 Copyright Microsoft corporation