3. Agenda What is Silverlight? Anatomy of a Silverlight Application XAML Primer Control Libraries Data Binding Development Tools Advanced Features Designer + Developer Experience
8. Development Tools XamlPad XamlPadX Kaxaml Silverlight Spy Expression Blend See my and Denny’s sessions later today for more! Visual Studio 2008 + Silverlight SDK
10. Silverlight works with any server Only requirement is to serve up XAML, assemblies etc. Leverage JavaScript to improve experience ASP.NET AJAX adds further integration to the experience <asp:xaml> <asp:media> More coming… Silverlight Component (XAML, .NET) AJAX Control (Script) ASP.NET AJAX Server Control Silverlight on the Server
11. Silverlight Architecture .NET for Silverlight Server Data WPF for Silverlight Inputs Media LINQ LINQ-to-XML Extensible Controls Keyboard WMV / VC1 Web Services ASP.NET AJAX Mouse WMA REST RSS SOAP BCL Dynamic Languages POX JSON Ink MP3 <asp:xaml> Ruby Python Generics Collections <asp:media> Silverlight Common Language Runtime XAML UI Core Controls DRM 2D Vectors Images Layout Media Animation Transforms Editing Text Presentation Core Integrated Networking Stack DOM Integration JavaScript Engine Installer Browser Host
16. Controls 60 Native Controls Open Source Toolkit Rich third party ecosystem for domain specific controls Canvas, Grid, & StackPanel will become your new best friends
18. Databinding Two way data binding from User interface to business objects Notification via INotifyPropertyChanged DataContext is inherited via Visual Tree From XAML <TextBlockText="{Binding Nasdaq.Points, Mode=OneWay}"/> From code Binding binding = new Binding("Nasdaq.Points"); binding.Mode = BindingMode.OneWay; TextBlocktb = new TextBlock(); tb.SetBinding(TextBlock.TextProperty, binding);
21. Flexible User Experience Options Seamless installation & auto-update Change download progress look & feel Full screen mode Out of Browser Experience Start menu & desktop shortcuts Internet connection detection
23. Templating Replace the ‘parts’ that define the look of a control to create a completely different look, but behavior is the same.
24. Isolated Storage Stream based access to a private file/directory structure Patterned after .NET Framework IsolatedStorage classes Read and write string or binary data Store is per application XAP Application code to request size increase User prompt to accept quota increase Quotas fall into predetermined size slots Code must initiate increase size call from within user input/event
26. HTML/AJAX and .NET integration webpage HTML Silverlight .NET language Javascript webpage HTML HTML + Silverlight
27. Access the HTML DOM from Managed Code HTML access available in new namespace usingSystem.Windows.Browser; Static HtmlPage class provides entry point HtmlPage.Navigate("http://www.microsoft.com"); String server = HtmlPage.DocumentUri.Host; Hookup events, call methods, or access properties HtmlElementmyButton = HtmlPage.Document.GetElementByID("myButtonID"); myButton.AttachEvent("onclick", new EventHandler(this.myButtonClicked)); privatevoidmyButtonClicked(object sender, EventArgs e) { ... }
28. Access Managed Code from JavaScript 1.- Mark a property, method or event as [Scriptable] [ScriptableMember] publicvoidSearch(stringName) { ... } 2.- Register a scriptable object HtmlPage.RegisterScriptableObject ("EntryPoint", this); 3.- Access the managed object from script var control = document.getElementById("SilverlightControl"); control.Content.EntryPoint.Search(input.value);
29. Streaming Media Experience Cost effective, high quality video for all major browsers Based on WMA and WMV ecosystem Media processing tools provided for live and on-demand publishing Supports HD video encoding Scales gracefully to lower end hardware Digital Rights Management support
30. DeepZoom Navigates images of any size and resolution optimizing network bandwidth and download size. Seamless transitions as you zoom and pan.
31. Easy Line of Business Apps Cost effective, high quality video for all major browsers Navigation Framework RIA Data Services
38. Networking Asynchronous HTTP requests GET/POST Access to most headers, cookies, Uses browser networking stack Caching, authentication, proxy , compression
39. Web Services SOAP 1.1 Basic profile A few restrictions (e.g. SOAP Faults not supported) Asynchronous invocation Follows cross-domain policy restrictions Generated proxies support data binding
40. Sockets TCP only Asynchronous API No explicit bind and no listen/accept support Restricted ports (4502-4534) Cross Domain based on provisioning server void Connect(AddressFamily family) { SocketAsyncEventArgsconnectArgs = new SocketAsyncEventArgs(); connectArgs.RemoteEndPoint = new DnsEndPoint( Application.Current.Host.Source.Host, 4502); connectArgs.Completed += new EventHandler<SocketAsyncEventArgs>(OnConnectCompleted); socket = new Socket(family, SocketType.Stream, ProtocolType.Tcp); if (!socket.ConnectAsync(connectArgs)) OnConnectCompleted(socket, connectArgs); }
Set context!!!! We will briefly discuss what is silverlight.. Why you should care and why we are excited about the benefitsSilverlight provided to <vertical> like you. We will focus a lot on the HOW !!! We will walk through features and hopefully give you a good overview of the technology and the platform inside Silverlight.
.NET for Silverlight is a factored subset of full .NETDesktop ~50 MB (Windows only)Silverlight + .NET Alpha ~ 4 MB (cross platform)How do we get it so small ?? Discuss a few of these as examples, don’t get too caught up on any On UI side: no Windows Forms, No 3D, No FlowLayout, etc. No workflow, no asp .net Web services server-side functionality… No ADO .NET ( but you get LINQ) Significant refactoring, e.g. File IO might not have all the overloads, but still way to get the job done.. Additional pieces of .NET available in a pay-for-play model…Same core development FrameworkThe shared apis & technologies are the same The tools are the sameHighly compatibleMinimal changes needed to move from Silverlight to DesktopHowever, not binary compatible by default
The usual suspectsCanvas, Panel, StackPanel, Grid Button, Calendar, Checkbox, Datagrid, DateTimePicker, GridSplitter, HyperLink, ListBox, Popup, Radio, Slider, Toggle, Tooltip,
DataTemplate is one of my favorite features.. Because it really showcases how Silverlight was built with data in mind from the ground up.. With a data template I can create a mapping between a specified CLR type or XML Xpath to some visuals…
Other interesting HTML integration scenarios:Persistent linksFwd/Back Integration
Simple type marshalling only in the AlphaComplex type support on the way
We saw how the platform is helping address this but a full solution requires role-specific tooling.
Web Client is used for downloading streams and strings We HttpWebRequest has more control over HTTP GET & POST headers ….The headers we don’t let you change are the same headers the browser does not let you override..