MIX11 – Session Review – Advanced Features in Silverlight 5

Nick Kramer (Senior Program Manager in the Silverlight Team) nkramer@microsoft.com


  • Unrestricted File Access
    • In Silverlight 4 trusted Apps can access
      • Documents
      • Music
      • Pictures
      • Videos
    • Silverlight 5 Trusted Aps can access everything
      • Using Standard System.IO classes
  • Trusted Apps In-Browser
    • SL4: has OOB apps run in trusted with user consent
    • SL5: in-browser trusted apps with admin consent
      • Set permissions via group policy
      • No prompts or installs
      • familiar navigation model
      • can be part of a large HTML site
        Feature Sandboxed App Trusted SL4 App Trusted SL5 App
        Prompt-free No Yes Yes
        Cross domain networking No Yes Yes
        Full keyboard in fullscreen mode No Yes Yes
        COM No Yes Yes
        Unrestricted File Access No Special Folders only Yes
        P/Invoke No No Yes
        Run in-browser No No Yes
    • Creating a In-Browser Trusted App
      • Part 1 – Ask for Trust:
        • In the current Beta it’s just like SL4 trusted OOB
          • Set the OOB SecuritySettings ElevatedPermissions = “Required”
      • Part 2 – Sign your XAP
        • Sign your .xap
          • Same as for a trusted OOB
          • In Visual Studio or on command line
        • Note: if you run an in-browser trusted app in localhost you don’t need to sign your .xap file
  • Group Policy
    • Actually, only one permission – Trusted or not
    • Network admin specifies which publishers are trusted
      • Publishers identified by Authenticode certificate
      • Put certificate in client machine’s trust publisher store
      • Same as ClickOnce
    • Xaps are associated with publishers by Authenticode
    • The trust is not for a specific app but for a certificate, and so every sl5 app that is sign with the same certificate will be trusted
  • P/Invoke (Coming Soon) – Only on Windows
    • P/Invoke lets you call native code
    • COM (SL4) also lets you call native code
      • Anything you can do with COM can also be done with P/Invoke
        • Strongly Typed
        • No COM registration
      • P/Invoke is optimized for Win32 APIs & native C/C++ code
      • COM is optimized for COM Automation APIs, example Office
    • COM & P/Invoke are available on Windows to trusted apps
    • How to use it
      • Works exactly the same as in the .NET Framework
      • Part 1: Setting up the declaration
        • [DllImport(“kernel32.dll”)]
        • static extern int GetDriveType(string lpRootPathName);
      • Part 2: Using it
        • int type = GetDriveType(drive);
  • HTML Support (Coming Soon)
    • Use HTML inside Silverlight Apps
      • To reuse existing HTML/ASP.NET content
      • To integrate with outside websites
    • In SL4, only OOB’s got WebBrowser (based on the WebOC)
    • In SL5, in-browser WebBrowser support (based on WebOC/IE)
      • trying to extent that to browsers not WebOC
      • WebBrowser control
    • Currently with SL5 the WebBrowser control in-Browser runs only on IE
    • You also have the WebBrowser Brush that is not interactive but it will make it possible to use it as the brush for other controls
  • Multiple Windows (Coming Soon)
    • Works only in OOB
    • System.Windows.Window is now an instantiable class
      • Window w = new Windows();
      • w.Height=400;
      • w.Width=600;
      • w.Content = new MyUserControl();
      • w.Visibility = Visibility.Visible;
    • Window Titles and Positioning are now completely up to the developer, and not strict as it was in SL4
    • Sandboxed OOBs automatically have the domain name added to the window title as a security measure
  • 64-bit (Coming Soon)
    • 64-bit machines & apps becoming increasingly common
    • SL5 can run in 64-bit process
      • 64-bit browsers
      • Sidebar on 64-bit Windows
    • Why 64-bit is interesting
      • Because you don’t get to choose the browser
      • Because you’re native hosting in 64-bit process
      • Because you need a lot of address space (taking advantage of address space)
  • Pivot Viewer (Coming Soon)
    • Ships as part of the SL5 SDK
    • Dynamic client-based collections
    • XAML-based visuals
      • You can define your visuals instead of the Bitmap
      • You can define different visuals for different zoom levels
    • Customizability
      • Now we have access to the fonts, sizes, colors, and so on ..
    • It will have the same process for binding as the DataGrid (ItemsSource)

Silverlight still has size constraints, currently with 7 MB with the version 5.

Call to Action

2 thoughts on “MIX11 – Session Review – Advanced Features in Silverlight 5

Leave a Reply

Your email address will not be published. Required fields are marked *