1 / 36

Sharing Skills and Code with Silverlight & WPF

Sharing Skills and Code with Silverlight & WPF. Jeff Wilcox Software Development Engineer Microsoft Corporation. Sharing Skills and Code . Client Platform Vision What’s shared between Silverlight & WPF? Today’s controls and features Silverlight controls Silverlight Toolkit WPF Toolkit

daw
Download Presentation

Sharing Skills and Code with Silverlight & WPF

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sharing Skills and Code with Silverlight & WPF Jeff Wilcox Software Development Engineer Microsoft Corporation

  2. Sharing Skills and Code • Client Platform Vision • What’s shared between Silverlight & WPF? • Today’s controls and features • Silverlight controls • Silverlight Toolkit • WPF Toolkit • Building controls for Silverlight & WPF • Bringing it all together

  3. Why? • Become a .NET expert once • Choice of .NET languages • Great Microsoft tools • Shared libraries and patterns • Develop a versatile skill set • Flexibility • Apply skills to RIA & LOB • Efficient • Not about building apps that “work just” everywhere

  4. Client Platform Vision • Great platforms • Maximize reach with Silverlight • Add value with WPF • Shared skills, techniques, vocabulary • Create once, use everywhere • XAML • .NET code • Tests • World-class developer & designer tools

  5. Current state of Microsoft Client Platforms • Silverlight 3 • Silverlight Toolkit • .NET 4 • We’re working to ensure compatibility

  6. You don’t have to be a code ninja!

  7. demo A simple shared app

  8. What just happened? • Shared .NET platform • Shared development environment • Visual Studio • Blend • Shared components • Presentation platform • Rich charting and data grid controls • 100% the same source code

  9. Shared Client Platform

  10. Shared Gu Technology

  11. Shared .NET Framework • Great application platform • Powerful runtime • Great language support • C# • Visual Basic • Dynamic languages • Python • Ruby • Amazing communities

  12. Business objects • Modern .NET business objects and logic “just work” • Collections • Generics • LINQ • Easy to add framework-specific value

  13. Same references!

  14. Core Building Blocks • XAML • Rich compositing • Shapes • Visual tree • Managed framework • Dependency & attached properties • Events • Control model • Controls • Layout

  15. Improving compatibility • Silverlight Toolkit • March 2009 release • Silverlight 2 and Silverlight 3 releases available • Silverlight 2 development continues • WPF Toolkit • Available today • .NET 4

  16. Silverlight Toolkit • Fills today’s slight compatibility gap • Developing new controls with a rapid development cycle • Ships in the Silverlight SDK and on CodePlex

  17. Silverlight Toolkit • WPF compatible controls • DockPanel • WrapPanel • TreeView • WPF compatible features • ImplicitStyleManager • LayoutTransformer • New controls offered for Silverlight & WPF • Charting • AutoCompleteBox

  18. WPF Toolkit & .NET 4 • Calendar • DatePicker • DataGrid • VisualStateManager

  19. Building controls

  20. Building controls • Step 1. Basics & C# strategy • Step 2. Source layout • Step 3. Dependency properties • Step 4. XAML • Step 5. Default styles • Step 6. VSM • Step 7. Wild hacks

  21. Building controls • Step 1. Basics & C# strategy • Step 2. Source layout • Step 3. Dependency properties • Step 4. XAML • Step 5. Default styles • Step 6. VSM • Step 7. Wild hacks

  22. C# Techniques • Partial classes • Extension methods and utility classes • Preprocessor directives #if SILVERLIGHT // Silverlight #else // WPF #endif

  23. Source Layout • Peer folders for Silverlight & WPF • File links and source control Silverlight\ Control.csproj Control.cs Themes\Generic.xaml Wpf\ Control.csproj Control.cs Themes\Generic.xaml

  24. Dependency Properties • Avoid WPF-specific metadata • Coercion • Read-only properties

  25. Building controls • Step 1. Basics & C# strategy • Step 2. Source layout • Step 3. Dependency properties • Step 4. XAML • Step 5. Default styles • Step 6. VSM • Step 7. Wild hacks

  26. XAML • Use WPF namespace • Watch out for the Silverlight 1.0 namespace xmlns=“http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" http://schemas.microsoft.com/client/2007

  27. Building controls • Step 1. Basics & C# strategy • Step 2. Source layout • Step 3. Dependency properties • Step 4. XAML • Step 5. Default styles • Step 6. VSM • Step 7. Wild hacks

  28. Default styles • Default styles and templates for controls are selected via DefaultStyleKey property • Defined differently • WPF: Static constructor • Silverlight: Instance constructor

  29. Building controls • Step 1. Basics & C# strategy • Step 2. Source layout • Step 3. Dependency properties • Step 4. XAML • Step 5. Default styles • Step 6. VSM • Step 7. Wild hacks

  30. Building controls • Step 1. Basics & C# strategy • Step 2. Source layout • Step 3. Dependency properties • Step 4. XAML • Step 5. Default styles • Step 6. VSM • Step 7. Wild hacks

  31. Wild hacks • Declare routed events in a partial class • MyControl.Wpf.cs • Firing routed events source.OnSelectionChanged(new SelectionChangedEventArgs( #if SILVERLIGHT SelectionChangedEvent, #endif removed, added));

  32. Wild hacks • Helper extension methods • Utility classes • Abstract out application model differences • Abstract Client Platform differences var x = new GlobalExceptionHandler(MyHandler); x.InterceptUnhandledExceptions = true;

  33. demo Putting it all together

  34. Please complete session feedback! • Deck and demo will be posted tonight • Silverlight Toolkithttp://silverlight.codeplex.com/ • Jeff Wilcox’s bloghttp://www.jeff.wilcox.name/

  35. © 2009 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.

More Related