Intro to Silverlight Kevin Grossnicklaus Introductions • Kevin Grossnicklaus – SSE - www.SSEinc.com (1998-2009) • Chief Architect • Software Development Practice Leader – CAIT (2003-2009) • Instructor • Email: kvgros@SSEinc.com • Blog: http://geekswithblogs.net/kgrossnicklaus Agenda • History • Silverlight • Tools – Expression Blend 3 w/ Sketchflow – VS.NET 2K8,2010 • Resources • Questions Brief History of .NET • • • • • • 2001 - .NET 1.0 (VS.NET) 2003 - .NET 1.1 (VS.NET 2K3) 2005 - .NET 2.0 (VS.NET 2K5) 2006 - .NET 3.0 (WPF/WCF/WF) 2008 - .NET 3.5 (VS.NET 2K8) 2010 - .NET 4.0 (VS.NET 2010) History of Silverlight • WPF/E (Everywhere) released in 2006 shortly after .NET 3.0 • MIX 2007 – Announcement that WPF/E was renamed “Silverlight” and Silverlight 1.0 was released • MIX 2008 – Release of Silverlight 2.0 • MIX 2009 – Announcement of Silverlight 3.0 What is Silverlight? • Browser Plug-in with a compact version of the .NET framework and the ability to render UI elements via XAML/WPF Silverlight vs. Flash Flash Silverlight • Small deployment footprint via Browser Plug-in • Support for Windows, Mac, and Linux • Code in ActionScript • Integrates with JavaScript • Adobe Flash as Dev Tool • Heavy animation and multimedia support • Rich set of existing UI components • HUGE existing adoption • Many other features • • • • • • • • • • Larger than Flash but still small and much easier to install than full .NET framework Runs on Windows and Mac OSX (plus Linux w/ Moonlight) Code in C# or VB.NET Integrates easily with JavaScript Easily call any services VS.NET as Dev Tool Brings plug-in development to the .NET development community Heavy animation and multi-media support Rich set of existing UI components Many other features UI Options in .NET • Installed on Desktop – WinForms – WPF • Browser Based – ASP.NET (w/ AJAX) – ASP.NET MVC – Silverlight – (Mix of the above) Silverlight Platform Support • Windows • Mac OSX • Linux support provided by the Moonlight plug-in developed as part of the Mono project Silverlight Terminology • • • • • • WPF WCF XAML XAP AJAX RIA Silverlight Development Tools Primary Tools • VS.NET 2008 SP1, 2010 • Silverlight SDK • Expression Blend 2/3 Helpful Tools • Kaxaml (www.Kaxaml.com) • Fiddler (www.fiddler2.com) Silverlight Resources Primary Links • www.Silverlight.net • www.Asp.net • www.CodePlex.com/SilverL ight • go-mono.com/moonlight/ Misc Links • www.silverlight.net/showca se • http://karlshifflett.wordpre ss.com/xaml-power-toys/ • www.codeplex.com/composit ewpf Silverlight Showcase • www.Silverlight.net/ShowCase How does Silverlight work? • Plug-In Installation • Deployment – What is XAP? • Plug-In Hosting – Server does not require .NET The Silverlight BCL (CoreCLR) • OUT: – – – System.Data System.Deployment Traditional XML manipulation using System.Xml • – Non-Generic collections • – – No COM support IN: – – All native types with full functionality Full LINQ Support • – – – – – • Use Generic’s instead System.Runtime.Remoting System.Runtime.InteropServices • • LINQ to XML instead Including LINQ to XML Full support calling services (either ASMX or WCF) Powerful XAML with rich Silverlight Controls Same garbage collection, memory management, and assembly management as full runtime Threading Support Generics DIFFERENT: – Security Model WPF vs. Silverlight • WPF – – – – – – Requires full .NET Framework (3.0+) be installed on client Only supports Windows Full access to all local resources Full rights to local resource due to .NET code access security model More powerful UI components and flexible UI composition model More ability to take advantage of local audio/video resources • i.e. Video and sound cards • Silverlight – – – – – – Supported by Plug-In Supported on other platforms Same XAML languages for declaring UI Subset of WPF controls Subset of .NET framework functionality Limited access to local resources and constrained to browser sandbox Key Components of a Silverlight 2.0 Application • • • • • UI = XAML Logic = C#/VB.NET Data = Classes Data Access = WCF Services Navigation = User Controls Silverlight Controls • Out of the Box Controls (Ship w/ framework) • Silverlight Control Toolkit – Silverlight.Codeplex.com – Similar to AJAX Control Toolkit – Microsoft and Community Supported Data in Silverlight • Data Classes – INotifyPropertyChanged • Generics – i.e. List<Person> • ObservableCollection – Raises events on change • XAML Data Binding Databinding in Silverlight • Can be declared via Mark-Up extensions in XAML or via code • Key Code Properties: – DataContext – ItemsSource • Basic Binding in XAML: – Using “Binding” Markup-Extension Text=“{Binding NameFirst}” Silverlight Demo • Silverlight 3.0 features • Silverlight LOB Application Expression Blend 3 Expression Blend 3 • • • • • • Componentized UX behaviors – no coding Designing with data Adobe Photoshop and Illustrator import XAML, C# and VB code intellisense Source code control integration SketchFlow SketchFlow • Breakthrough design prototyping • Visually explore composition and navigation • Communicate design alternatives to stakeholders • Solicit their feedback Visual Studio 2010 Visual Studio 2010 • Modern, enhanced user experience • Democratizing application lifecycle management • Inspiring developer delight • Great web development experience • Silverlight designer support • Cloud development and deployment • More database support – DB2 & Oracle DEMO Visual Studio 2010 Available today • • • • Silverlight 3 & IIS Media Services Silverlight 3 Tools for Visual Studio 2008 Expression Blend 3 Visual Studio 2010 Beta Bueller?