Silverlight 2 Andrew Pardoe Program Manager CLR Execution Engine
Rich interactive applications Web deployment gives broad reach Windows, Mac OS X, Linux IE, Firefox, Safari, Konquerer Sandboxing provides security Productive design and development Reusable knowledge (XAML &.NET) Best developer tools in the industry Separate design and development
Mac OS X Silverlight 1.0 supports all hardware Silverlight 2 supports Intel Mac Mac is fully supported by Microsoft Major Linux distributions Moonlight runtime implemented by Mono Full cooperation of Microsoft Access to documentation and tests Legal covenant protecting Mono users
Sandboxed applications No user elevation or security prompts within the browser—just click a URL Applications prevented from doing malicious things Limited local interaction Safe isolated storage Client based file upload controls Cross domain networking support
Silverlight “code-behind” model Code lives behind the page Updating the code doesn’t change the design Productive design and development Reusable knowledge (XAML &.NET) Best developer tools in the industry Separate design and development
Designers and developers are different.
Developers work from the inside outward.
Getting started
Silverlight 2 Beta 1 Notepad No SDK required, everything is text A better option… Silverlight Tools for Visual Studio 2008 Expression Blend 2.5 March Preview Everything you need is online
Building “Hello world” in Expression Blend CODE
XAML
eXtensible Application Markup Language Declarative language Rich development tools create plain text Search engines can index Silverlight pages
Composable, reusable UI elements SL 2 adds 20+ controls to the toolbox
Silverlight 2 controls DEMO
Visual Studio automatically declares fields for all x:Name elements Named controls can be referred to in code-behind with full Intellisense support
Event handlers add actions to controls Can be wired up declaratively in XAML or in code-behind with C# Page_Loaded
SL2 Beta 1 adds networking options HTTP, WS*/SOAP, REST, RSS, JSON System.Net.Sockets for non-HTTP protocols such as chat servers Cross domain networking support crossdomain.xml & clientaccesspolicy.xml
Wiring up events with code-behind CODE
Databinding
Databinding allows separation of data presentation and code-behind Works with any IEnumerable object Arrays, Lists, Collections DataTemplates control data presentation Binding can be one-way or two-way
Silverlight 2 introduces new layouts Canvas Drawing surface with relative positions StackPanel Stacks elements vertically or horizontally Grid Arbitrary specification of columns Layout system is customizable TilePanel, RadialPanel, etc.
Language INtegrated Query adds native data querying to.NET Can query, project and filter data from many sources Can be intermixed with C#, VB, etc. Silverlight 2 includes System.LINQ and System.LINQ.Expression
Querying data with LINQ CODE
Finishing touches
Customization mechanisms in XAML Brushes Solid, gradient, image, video Transformations Rotate, scale, skew, translate User controls can expose custom events and properties
Styles allow look and feel of a control to be defined externally Similar to StyleSheets in HTML Define for one file or for entire application by placing in App.xaml
Finished Silverlight app CODE
Business logic is directly usable in Windows applications Silverlight XAML is subset of WPF Silverlight Base Class Library is subset of full.NET Framework CoreCLR runs the same code the same as the desktop CLR Mobile phone support Windows Mobile Symbian OS (Nokia)
Our SL app as WPF DEMO
Extras
Silverlight allows manipulation of HTML DOM and JavaScript integration Wraps DOM and JS elements in managed wrappers SL can call JS, JS can call managed
Silverlight can prompt for local files No need to upload them to the server Security constraints Files opened are read-only Isolated storage provides write access
Questions? Q&A
Silverlight – Get Started Scott Guthrie’s blog – VP for SL and.NET Where to find these slides Moonlight –Silverlight support on Linux
© 2007 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.