XAML: One Language to Rule Them All


Published on

Published in: Technology
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

XAML: One Language to Rule Them All

  1. 1. XAML One Language to Rule Them All Frank La Vigne Lead Designer Applied Information Sciences http://www.franksworld.com
  2. 2. 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 to Frank.LaVigne@appliedis.com
  3. 3. Goals
  4. 4. The 3 R’s of Client Development
  5. 5. Reach: The Web Widest possible reach From 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 debug Easy to Deploy User experience varies
  6. 6. Rich: Windows Client Application Richest experience possible Response time is instantaneous WPF applications can leverage hardware acceleration for some truly engaging user experiences Easy to Debug Narrow focus Deployment concerns
  7. 7. RIA: Silverlight Applications Happy Medium of Reach and Rich Response time is instantaneous Runs on Windows, Mac and Linux Easy to Debug Wide focus Easy deployment Enables great user experiences
  8. 8. But Wait, There’s More!
  9. 9. The Fantastic Four of Client Technology
  10. 10. Silverlight Out of Browser Applications
  11. 11. XBAP?
  12. 12. XBAP Defined Slightly Better Reach, a Lot More Rich All the benefits of Silverlight The Power of WPF in a browser window 3D, Drag & Drop, Printing, Hardware Acceleration Easy to Debug Easy deployment (Windows w/ .NET 3.x) Enables great user experiences
  13. 13. When to Use XBAPs To quickly push a WPF app onto the web When Management demands that applications be web based When Windows is the client platform Ideal for corporate intranet Specialized applications Quickly moving a WPF application to the web
  14. 14. Demo quot;Sawdustquot;
  15. 15. How Can I Create an XBAP? Open Visual Studio 2008 File  New Project  WPF Browser Application
  16. 16. How Do I Deploy an XBAP? In Visual Studio 2008 Build  Publish
  17. 17. Deploying an XBAP: Mime Types MIME Type File Extension application/manifest .manifest application/x-ms-xbap .xbap application/octet-stream .deploy application/x-ms-application .application application/vnd.ms-xpsdocument .xps application/xaml-xml .xaml
  18. 18. Let the LOLCats Guide Us Demo Creating & Publishing an XBAP Application
  19. 19. 3-2-1 Launch! Three Choices for Two Core One Common Client Technologies Language Applications
  20. 20. One Markup Language to Rule Them All
  21. 21. Mostly the Same WPF Only Gaps Silverlight Only Shared
  22. 22. But the Differences Will Get You WPF Only Gaps Silverlight Only Shared
  23. 23. Caution: Eye Charts Ahead!
  24. 24. Different Feature Sets.. Deep Zoom 3D VC-1 codec Documents H.264 codec 3 Drag Drop HTML integration Win32 Interop Sandbox Triggers VideoBrush Commands Plane Projection 3 Printing Logical tree Adorners Hosting WebBrowser
  25. 25. Graphics Hardware acceleration Hardware acceleration 3 Graphics are Multi-core optimizations Drawings Lighter weight visuals Streams Graphics are Shapes Shapes
  26. 26. Property System More inherited properties Extensible Property Metadata Default Values Coercion
  27. 27. Resources generic.xaml generic.xaml Delayed instantiation of XamlReader can load StaticResources Resource Dictionaries. Merged Resource Dictionaries FindResource walks the tree Freezables
  28. 28. Databinding UIElement to UIElement bindings UIElement to UIElement bindings 3 MultiBinding Binding support at FrameworkElement Binding support at DependencyObject No TargetType on data templates Dictionaries Relative bindings Template selectors More Type converters out of the box
  29. 29. Eventing Events are synchronous Events are asynchronous Not all events bubble, even Tunneling (Preview) events if declared as Routed Mouse Wheel
  30. 30. Styles Write-once No app themes No BasedOn No triggers
  31. 31. Animation MotionPath Animation Named key-frames CompositionTarget.Rendering Storyboard APIs More animatable types Begin, Stop, etc. Extensibility Storyboard APIs added in 3.5 SP1
  32. 32. Input Support for other platforms Key.Unknown ModifierKeys.Apple KeyEventArgs.PlatformKeyCode
  33. 33. Layout LayoutTransform Text measures early
  34. 34. Other More markup-extensions Different Hit-Testing e.g. x:Static LayoutRounding Property More panels No XamlWriter No VisualBrush No OnRender
  35. 35. Demo Enough Slides! Code Time WPF  XBAP WPF  Silverlight
  36. 36. Tips & Tricks for Recycling XAML Source compatibility (not binary compatibility) It is a different framework Code to Silverlight (Common Denominator) Create a different VS project for each ‘run-time’ Link the files together Use WPF’s XML namespace declaration xmlns=quot;http://schemas.microsoft.com/winfx/2006/xaml/p resentationquot;
  37. 37. 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 chunks Can use separate files altogether Place Templates and styles in App.xaml (both platforms can pick from there)
  38. 38. Other API differences OpenFileDialog SL = System.Windows.Controls WPF: Microsoft.Win32 Dispatcher.BeginInvoke different signatures SL has more classes sealed (can’t be inherited) XamlReader.Load SL = XamlReader.Load ( string ) WPF = XamlReader.Load ( stream )
  39. 39. Other API differences (cont’d) ContentPresenter SL : class ContentPresenter : Control WPF : class ContentPresenter : FrameworkElement UIElementCollection SL : UIElementCollection : PresentationFrameworkCollection<UIElement> WPF : UIElementCollection : IList, ICollection, Ienumerable
  40. 40. THANK YOU! Frank La Vigne www.FranksWorld.com frank@franksworld.com @Tableteer