XAML: One Language to Rule Them All

40
XAML One Language to Rule Them All Frank La Vigne Lead Designer Applied Information Sciences http://www.franksworld.com

description

 

Transcript of XAML: One Language to Rule Them All

Page 1: XAML: One Language to Rule Them All

XAML One Language to Rule Them All

XAML One Language to Rule Them All

Frank La VigneLead DesignerApplied Information Scienceshttp://www.franksworld.com

Page 2: XAML: One Language to Rule Them All

Ego Slide

Frank La Vigne Microsoft MVP: Tablet PC INETA Membership Mentor for DC,

Maryland and Delaware Manager DC Silverlight SIG Lead Designer @ AIS

Blog: www.franksworld.com Company: www.appliedis.com Twitter: @Tableteer

Feedback [email protected]

Page 3: XAML: One Language to Rule Them All

Goals

Page 4: XAML: One Language to Rule Them All

The 3 R’s of Client Development

Reach RIA Rich

Client Continuum

Page 5: XAML: One Language to Rule Them All

Reach: The Web

Widest possible reachFrom text only devices to desktops;from laptops to mobile phones;the web works just about anywhere

Platform/Browser Independent**Write once, test everywhere in every

conceivable combination.Hard to debugEasy to DeployUser experience varies

Page 6: XAML: One Language to Rule Them All

Rich: Windows Client Application

Richest experience possibleResponse time is instantaneousWPF applications can leverage hardware acceleration for some truly engaging user experiences

Easy to DebugNarrow focusDeployment concerns

Page 7: XAML: One Language to Rule Them All

RIA: Silverlight Applications

Happy Medium of Reach and RichResponse time is instantaneousRuns on Windows, Mac and Linux

Easy to DebugWide focusEasy deploymentEnables great user experiences

Page 8: XAML: One Language to Rule Them All

But Wait, There’s More!

MORE!

Page 9: XAML: One Language to Rule Them All

The Fantastic Four of Client Technology

Reach RIA XBAP Rich

XAML

Client Continuum

Page 10: XAML: One Language to Rule Them All

Silverlight Out of Browser Applications

NEW IN VERSION 3

Page 11: XAML: One Language to Rule Them All

XBAP?

What’s an

XBAP?

Page 12: XAML: One Language to Rule Them All

XBAP Defined

Slightly Better Reach, a Lot More RichAll the benefits of SilverlightThe Power of WPF in a browser window

3D, Drag & Drop, Printing, Hardware Acceleration

Easy to DebugEasy deployment (Windows w/ .NET 3.x)Enables great user experiences

Page 13: XAML: One Language to Rule Them All

When to Use XBAPs

To quickly push a WPF app onto the webWhen Management demands that applications be web basedWhen Windows is the client platform

Ideal for corporate intranetSpecialized applicationsQuickly moving a WPF application to the web

Page 14: XAML: One Language to Rule Them All

Demo

"Sawdust"

Page 15: XAML: One Language to Rule Them All

How Can I Create an XBAP?Open Visual Studio 2008

File New Project WPF Browser Application

Page 16: XAML: One Language to Rule Them All

How Do I Deploy an XBAP?In Visual Studio 2008

Build Publish

Page 17: XAML: One Language to Rule Them All

Deploying an XBAP: Mime Types

MIME Type File Extensionapplication/manifest .manifestapplication/x-ms-xbap .xbapapplication/octet-stream .deployapplication/x-ms-application .applicationapplication/vnd.ms-xpsdocument .xpsapplication/xaml-xml .xaml

REMEMBER TO SET THE FOLLOWING MIME TYPES ON YOUR SERVER

Page 18: XAML: One Language to Rule Them All

Demo

Let the LOLCats Guide Us

Creating &Publishing anXBAP Application

Page 19: XAML: One Language to Rule Them All

3-2-1 Launch!

Three Choices for Client Applications Two Core Technologies One Common

Language

XAML Powers It All

Page 20: XAML: One Language to Rule Them All

One Markup Language to Rule Them All

Page 21: XAML: One Language to Rule Them All

Mostly the Same

WPF OnlyGapsSilverlight OnlyShared

Page 22: XAML: One Language to Rule Them All

But the Differences Will Get You

WPF OnlyGapsSilverlight OnlyShared

Page 23: XAML: One Language to Rule Them All

Caution: Eye Charts Ahead!

Page 24: XAML: One Language to Rule Them All

Different Feature Sets..

3D Documents Drag Drop Win32 Interop Triggers Commands Printing Logical tree Adorners Hosting WebBrowser

Deep Zoom VC-1 codec H.264 codec 3 HTML integration Sandbox VideoBrush Plane Projection 3

Page 25: XAML: One Language to Rule Them All

Graphics

Hardware acceleration Graphics are

Drawings Streams Shapes

Hardware acceleration 3 Multi-core optimizations Lighter weight visuals Graphics are

Shapes

Page 26: XAML: One Language to Rule Them All

Property System

More inherited properties Extensible

Property Metadata Default Values Coercion

Page 27: XAML: One Language to Rule Them All

Resources

generic.xaml Delayed instantiation of

StaticResources Merged Resource

Dictionaries FindResource walks

the tree Freezables

generic.xaml XamlReader can load

Resource Dictionaries.

Page 28: XAML: One Language to Rule Them All

Databinding

UIElement to UIElement bindings MultiBinding Binding support at DependencyObject

Dictionaries Relative bindings Template selectors More Type converters out of the box

UIElement to UIElement bindings 3

Binding support at FrameworkElement No TargetType on data templates

Page 29: XAML: One Language to Rule Them All

Eventing

Events are synchronous Tunneling (Preview) events Mouse Wheel

Events are asynchronous Not all events bubble, even

if declared as Routed

Page 30: XAML: One Language to Rule Them All

Styles

Write-once No app themes No BasedOn No triggers

Page 31: XAML: One Language to Rule Them All

Animation

MotionPath AnimationCompositionTarget.Rendering More animatable types ExtensibilityStoryboard APIs added in 3.5 SP1

Named key-framesStoryboard APIs

Begin, Stop, etc.

Page 32: XAML: One Language to Rule Them All

Input

Support for other platforms Key.Unknown ModifierKeys.Apple KeyEventArgs.PlatformKeyCode

Page 33: XAML: One Language to Rule Them All

Layout

LayoutTransform Text measures early

Page 34: XAML: One Language to Rule Them All

Other

More markup-extensions e.g. x:Static

More panels

Different Hit-Testing LayoutRounding Property No XamlWriter No VisualBrush No OnRender

Page 35: XAML: One Language to Rule Them All

Demo

Enough Slides!Code Time

WPF XBAP WPF Silverlight

Page 36: XAML: One Language to Rule Them All

Tips & Tricks for Recycling XAML

Source compatibility (not binary compatibility)

It is a different frameworkCode to Silverlight

(Common Denominator)Create a different VS project for each ‘run-time’

Link the files together

Use WPF’s XML namespace declarationxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

Page 37: XAML: One Language to Rule Them All

Tips & Tricks for Recycling Source Code

Use #if for small logic Move all conditional logic to code (no #if in XAML)

Partial classes for larger chunksCan use separate files altogether

Place Templates and styles in App.xaml (both platforms can pick from there)

Page 38: XAML: One Language to Rule Them All

Other API differences

OpenFileDialog SL = System.Windows.ControlsWPF: Microsoft.Win32

Dispatcher.BeginInvoke different signaturesSL has more classes sealed (can’t be inherited) XamlReader.Load

SL = XamlReader.Load ( string ) WPF = XamlReader.Load ( stream )

Page 39: XAML: One Language to Rule Them All

Other API differences (cont’d)

ContentPresenterSL : class ContentPresenter : Control WPF : class ContentPresenter : FrameworkElement

UIElementCollection SL : UIElementCollection : PresentationFrameworkCollection<UIElement>WPF : UIElementCollection : IList, ICollection, Ienumerable

Page 40: XAML: One Language to Rule Them All

THANK YOU!

Frank La [email protected]@Tableteer