introduction to wpf engines
TRANSCRIPT
Tamir KhasonSoftware consultermPrest systems
[email protected]://blogs.microsoft.co.il/blogs/tamir
04/12/23 1© 2001-2007 Copyright Microsoft corporation
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
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
No demos – don’t you already use it in your developments?
Platforms?
Windows XP Home/Pro SP2
Windows Server 2003
Windows Vista
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
Engines involved
WTF2 Inside there
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
WPF fundamentals
Basic Architecture
XAML Layout Controls
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
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
Layout - Panels
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
eXtensible Application Markup Language
WTF3 XAML
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>
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…
How they make our live easier?
WTF4 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
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
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
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
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
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
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
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
What’s going on over designer’s scheme?
WTF5 Expression
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.
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
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
WTFn - Where's the Food?
© 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