Clint EdmonsonArchitect EvangelistMicrosoftEmail:    clinted@microsoft.comWeb:     http://www.notsotrivial.netTwitter: @clintedJumpStart: Silverlight
AgendaWhat is Silverlight?Anatomy of a Silverlight ApplicationXAML PrimerControl LibrariesData BindingDevelopment ToolsAdvanced FeaturesDesigner + Developer Experience
What is Silverlight?
Silverlight ExperienceRich Internet ApplicationsCross platform,    cross-browser,    cross device    plug-inFast, seamless installationVector based layout and animation engineProductive design & development environments
Refactored subset of .NET & WPF
Development Tools
Development ToolsXamlPadXamlPadXKaxamlSilverlight SpyExpression BlendSee my and Denny’s sessions later today for more!Visual Studio 2008 + Silverlight SDK
Anatomy of a Silverlight Application
Silverlight works with any serverOnly requirement is to serve up XAML, assemblies etc.Leverage JavaScript to improve experienceASP.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 ControlSilverlight on the Server
Silverlight Architecture.NET for SilverlightServerDataWPF for SilverlightInputsMediaLINQLINQ-to-XMLExtensible ControlsKeyboardWMV / VC1Web ServicesASP.NET AJAXMouseWMARESTRSSSOAPBCLDynamic LanguagesPOXJSONInkMP3<asp:xaml>RubyPythonGenericsCollections<asp:media>Silverlight Common Language RuntimeXAMLUI CoreControlsDRM2D VectorsImagesLayoutMediaAnimationTransformsEditingTextPresentation CoreIntegrated Networking StackDOM IntegrationJavaScript EngineInstallerBrowser Host
XAML Primer
XAMLC#VB.NET<Button Width="100"> OK  <Button.Background>LightBlue  </Button.Background></Button>Button b1 = new Button();b1.Content = "OK";b1.Background = new SolidColorBrush(Colors.LightBlue);b1.Width = 100;Dim b1 As New Buttonb1.Content = "OK"b1.Background = New _SolidColorBrush(Colors.LightBlue)b1.Width = 100Declarative Programming Through XAMLExtensible Application Markup LanguageToolable, declarative markup
Code and content are separate
Compatible with Windows Presentation FoundationControl Libraries
Controls60 Native ControlsOpen Source ToolkitRich third party ecosystem for domain specific controls Canvas, Grid, & StackPanelwill become your new best friends
Data Binding
Databinding	Two way data binding from User interface to business objects Notification via INotifyPropertyChangedDataContext is inherited via Visual TreeFrom 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);
Data TemplatesDataTemplateclass Car{  string Image {get;set}  string Model {get;set]}<DataTemplate x:Key="carTemplate">  <Border BorderBrush="Blue" BorderThickness="2" Background="LightGray"          Margin="10" Padding="15,15,15,5">    <StackPanel>      <Image HorizontalAlignment="Center" Source="{Binding Path=Image}" />      <Border HorizontalAlignment="Center" BorderBrush="Navy"              Background="#DDF“ BorderThickness="1" Margin="10" Padding="3">        <TextBlockFontSize="18" TextContent="{Binding Path=Model}" />      </Border>    </StackPanel>  </Border></DataTemplate>
Advanced Features
Flexible User Experience OptionsSeamless installation & auto-updateChange download progress look & feelFull screen modeOut of Browser ExperienceStart menu & desktop shortcutsInternet connection detection
StylingResource definition templates to define look & feel
Templating Replace the ‘parts’ that define the look of a control to create a completely different look, but behavior is the same.
Isolated StorageStream based access to a private file/directory structurePatterned after .NET Framework IsolatedStorage classesRead and write string or binary dataStore is per application XAPApplication code to request size increaseUser prompt to accept quota increaseQuotas fall into predetermined size slotsCode must initiate increase size call from within user input/event
OpenFileDialog, SaveFileDialogProvides native OS experienceSandboxed API returns safe filename and readable streamSupport for multiple files
HTML/AJAX and .NET integrationwebpageHTMLSilverlight.NETlanguageJavascriptwebpageHTMLHTML +Silverlight
Access the HTML DOM from Managed CodeHTML 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 propertiesHtmlElementmyButton =HtmlPage.Document.GetElementByID("myButtonID");myButton.AttachEvent("onclick", newEventHandler(this.myButtonClicked));privatevoidmyButtonClicked(object sender, EventArgs e)  { ... }
Access Managed Code from JavaScript1.- Mark a property, method or event as [Scriptable][ScriptableMember]publicvoidSearch(stringName) { ... }2.- Register a scriptable objectHtmlPage.RegisterScriptableObject ("EntryPoint", this);3.- Access the managed object from scriptvar control = document.getElementById("SilverlightControl");control.Content.EntryPoint.Search(input.value);
Streaming Media ExperienceCost effective, high quality video for all major browsersBased on WMA and WMV ecosystemMedia processing tools provided for live and on-demand publishingSupports HD video encodingScales gracefully to lower end hardwareDigital Rights Management support
DeepZoomNavigates images of any size and resolution optimizing network bandwidth and download size. Seamless transitions as you zoom and pan.
Easy Line of Business AppsCost effective, high quality video for all major browsersNavigation FrameworkRIA Data Services
Designer + DeveloperExperience
Designer/Developer Collaboration=
ToolingDesktopServer, ServicesServer                           Win7Media& RIAXAMLDesignerLook, behavior, brand,and emotional connectionDeveloperFunction, deployment, data,security, operational integrity
Next Steps…Community Site: http://silverlight.netMain Product Site: http://www.microsoft.com/silverlightMSDN Center: http://msdn.microsoft.com/silverlightOnline Forums: http://silverlight.net/forumsOnline SDK: http://msdn2.microsoft.com/bb188266.aspxTop Silverlight BlogsTim Sneath: http://blogs.msdn.com/timsMike Harsh: http://blogs.msdn.com/mharshJoe Stegman: http://blogs.msdn.com/jstegmanLaurence Moroney: http://blogs.msdn.com/webnextErnie Booth: http://blogs.msdn.com/eboothFollow @MSExpression on Twitter
Clint EdmonsonArchitect EvangelistMicrosoftEmail:    clinted@microsoft.comWeb:     http://www.notsotrivial.netTwitter: @clintedThank you!
Networking
Networking Asynchronous HTTP requestsGET/POST Access to most headers, cookies, Uses browser networking stack Caching, authentication, proxy  , compression
Web ServicesSOAP 1.1 Basic profileA few restrictions (e.g. SOAP Faults not supported)Asynchronous invocationFollows cross-domain policy restrictionsGenerated proxies support data binding

DODN2009 - Jump Start Silverlight

  • 1.
    Clint EdmonsonArchitect EvangelistMicrosoftEmail: clinted@microsoft.comWeb: http://www.notsotrivial.netTwitter: @clintedJumpStart: Silverlight
  • 3.
    AgendaWhat is Silverlight?Anatomyof a Silverlight ApplicationXAML PrimerControl LibrariesData BindingDevelopment ToolsAdvanced FeaturesDesigner + Developer Experience
  • 4.
  • 5.
    Silverlight ExperienceRich InternetApplicationsCross platform, cross-browser, cross device plug-inFast, seamless installationVector based layout and animation engineProductive design & development environments
  • 6.
  • 7.
  • 8.
    Development ToolsXamlPadXamlPadXKaxamlSilverlight SpyExpressionBlendSee my and Denny’s sessions later today for more!Visual Studio 2008 + Silverlight SDK
  • 9.
    Anatomy of aSilverlight Application
  • 10.
    Silverlight works withany serverOnly requirement is to serve up XAML, assemblies etc.Leverage JavaScript to improve experienceASP.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 ControlSilverlight on the Server
  • 11.
    Silverlight Architecture.NET forSilverlightServerDataWPF for SilverlightInputsMediaLINQLINQ-to-XMLExtensible ControlsKeyboardWMV / VC1Web ServicesASP.NET AJAXMouseWMARESTRSSSOAPBCLDynamic LanguagesPOXJSONInkMP3<asp:xaml>RubyPythonGenericsCollections<asp:media>Silverlight Common Language RuntimeXAMLUI CoreControlsDRM2D VectorsImagesLayoutMediaAnimationTransformsEditingTextPresentation CoreIntegrated Networking StackDOM IntegrationJavaScript EngineInstallerBrowser Host
  • 12.
  • 13.
    XAMLC#VB.NET<Button Width="100"> OK <Button.Background>LightBlue </Button.Background></Button>Button b1 = new Button();b1.Content = "OK";b1.Background = new SolidColorBrush(Colors.LightBlue);b1.Width = 100;Dim b1 As New Buttonb1.Content = "OK"b1.Background = New _SolidColorBrush(Colors.LightBlue)b1.Width = 100Declarative Programming Through XAMLExtensible Application Markup LanguageToolable, declarative markup
  • 14.
    Code and contentare separate
  • 15.
    Compatible with WindowsPresentation FoundationControl Libraries
  • 16.
    Controls60 Native ControlsOpenSource ToolkitRich third party ecosystem for domain specific controls Canvas, Grid, & StackPanelwill become your new best friends
  • 17.
  • 18.
    Databinding Two way databinding from User interface to business objects Notification via INotifyPropertyChangedDataContext is inherited via Visual TreeFrom 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);
  • 19.
    Data TemplatesDataTemplateclass Car{ string Image {get;set} string Model {get;set]}<DataTemplate x:Key="carTemplate"> <Border BorderBrush="Blue" BorderThickness="2" Background="LightGray" Margin="10" Padding="15,15,15,5"> <StackPanel> <Image HorizontalAlignment="Center" Source="{Binding Path=Image}" /> <Border HorizontalAlignment="Center" BorderBrush="Navy" Background="#DDF“ BorderThickness="1" Margin="10" Padding="3"> <TextBlockFontSize="18" TextContent="{Binding Path=Model}" /> </Border> </StackPanel> </Border></DataTemplate>
  • 20.
  • 21.
    Flexible User ExperienceOptionsSeamless installation & auto-updateChange download progress look & feelFull screen modeOut of Browser ExperienceStart menu & desktop shortcutsInternet connection detection
  • 22.
  • 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 StorageStream basedaccess to a private file/directory structurePatterned after .NET Framework IsolatedStorage classesRead and write string or binary dataStore is per application XAPApplication code to request size increaseUser prompt to accept quota increaseQuotas fall into predetermined size slotsCode must initiate increase size call from within user input/event
  • 25.
    OpenFileDialog, SaveFileDialogProvides nativeOS experienceSandboxed API returns safe filename and readable streamSupport for multiple files
  • 26.
    HTML/AJAX and .NETintegrationwebpageHTMLSilverlight.NETlanguageJavascriptwebpageHTMLHTML +Silverlight
  • 27.
    Access the HTMLDOM from Managed CodeHTML 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 propertiesHtmlElementmyButton =HtmlPage.Document.GetElementByID("myButtonID");myButton.AttachEvent("onclick", newEventHandler(this.myButtonClicked));privatevoidmyButtonClicked(object sender, EventArgs e) { ... }
  • 28.
    Access Managed Codefrom JavaScript1.- Mark a property, method or event as [Scriptable][ScriptableMember]publicvoidSearch(stringName) { ... }2.- Register a scriptable objectHtmlPage.RegisterScriptableObject ("EntryPoint", this);3.- Access the managed object from scriptvar control = document.getElementById("SilverlightControl");control.Content.EntryPoint.Search(input.value);
  • 29.
    Streaming Media ExperienceCosteffective, high quality video for all major browsersBased on WMA and WMV ecosystemMedia processing tools provided for live and on-demand publishingSupports HD video encodingScales gracefully to lower end hardwareDigital Rights Management support
  • 30.
    DeepZoomNavigates images ofany size and resolution optimizing network bandwidth and download size. Seamless transitions as you zoom and pan.
  • 31.
    Easy Line ofBusiness AppsCost effective, high quality video for all major browsersNavigation FrameworkRIA Data Services
  • 32.
  • 33.
  • 34.
    ToolingDesktopServer, ServicesServer Win7Media& RIAXAMLDesignerLook, behavior, brand,and emotional connectionDeveloperFunction, deployment, data,security, operational integrity
  • 35.
    Next Steps…Community Site:http://silverlight.netMain Product Site: http://www.microsoft.com/silverlightMSDN Center: http://msdn.microsoft.com/silverlightOnline Forums: http://silverlight.net/forumsOnline SDK: http://msdn2.microsoft.com/bb188266.aspxTop Silverlight BlogsTim Sneath: http://blogs.msdn.com/timsMike Harsh: http://blogs.msdn.com/mharshJoe Stegman: http://blogs.msdn.com/jstegmanLaurence Moroney: http://blogs.msdn.com/webnextErnie Booth: http://blogs.msdn.com/eboothFollow @MSExpression on Twitter
  • 36.
    Clint EdmonsonArchitect EvangelistMicrosoftEmail: clinted@microsoft.comWeb: http://www.notsotrivial.netTwitter: @clintedThank you!
  • 37.
  • 38.
    Networking Asynchronous HTTPrequestsGET/POST Access to most headers, cookies, Uses browser networking stack Caching, authentication, proxy , compression
  • 39.
    Web ServicesSOAP 1.1Basic profileA few restrictions (e.g. SOAP Faults not supported)Asynchronous invocationFollows cross-domain policy restrictionsGenerated proxies support data binding
  • 40.
    Sockets TCP onlyAsynchronous API No explicit bind and no listen/accept support Restricted ports (4502-4534) Cross Domain based on provisioning servervoid 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);}
  • 41.
    Cross-domain support <?xmlversion="1.0"?><!DOCTYPEcross-domain-policySYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"><cross-domain-policy> <allow-access-fromdomain="*" /></cross-domain-policy>2 formats: Flash policy fileSilverlight policy file Cross-domain.xml<?xmlversion="1.0"?><access-policy> <cross-domain-access> <policy> <allow-from> <domainuri="http://customers.shop.com”/>" <domainuri="http://partner.com/app.xap"/> </allow-from> <grant-to> <grantpath="/sales/serialnumbers.xml" /> <grantpath="/partners"include-subpaths="false"/> </grant-to> </policy> </cross-domain-access></access-policy>clientaccesspolicy.xml

Editor's Notes

  • #2 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.
  • #4 .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
  • #15 The usual suspectsCanvas, Panel, StackPanel, Grid Button, Calendar, Checkbox, Datagrid, DateTimePicker, GridSplitter, HyperLink, ListBox, Popup, Radio, Slider, Toggle, Tooltip,
  • #16 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…
  • #17 Other interesting HTML integration scenarios:Persistent linksFwd/Back Integration
  • #18 Simple type marshalling only in the AlphaComplex type support on the way
  • #34 We saw how the platform is helping address this but a full solution requires role-specific tooling.
  • #36 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..