Archives / 2009 / November
  • Silverlight 4 presentation in Montreal (Qc)

    Jesse LibertyDon’t miss the next Montreal .NET Community meeting which RunAtServer Consulting will be the proud sponsor.

    Indeed we invited Jesse Liberty, the "Silverlight Geek” from Microsoft Boston, to speak on Silverlight 4!!
    This event is scheduled for December 7, 2009 at 6:15pm.

    As usual the presentation will be held in the Microsoft Montreal office at 2000 McGill College, 4th floor, Montreal, QC, H3A 3H3.

    Hope to see you there!





    Technorati Tags:


  • Silverlight 4 Clipboard access

    Silverlight 4 Silverlight 4 (currently in beta) adds support for Clipboard!

    In Silverlight 3 we had copy/paste available in the Textbox, programmatic access could be done, some IE only solution exists via HTML DOM bridge (so not OOB) or cross-browser (involving Flash!). But now the game has changed as we now have an API for multi-platform Clipboard access.

    In this beta, the support is for (Unicode) text-only, and the Clipboard class has 3 static methods:

    • GetText()
    • SetText()
    • ContainsText()

    Clipboard access can only be done from a user initiated action (mouse, keyboard), and user is prompted to acknowledge the first time Clipboard is set or read (once per session).


    If the application is running Out Of Browser and under the new elevated permission mode, user gets no prompt and Clipboard methods can be used anytime (not only during user initiated actions).

    I built a small sample to try this:

    Silverlight clipboard sample

    The code is pretty simple:

    private void btnCopy_Click(object sender, RoutedEventArgs e)
        if (txtCopy.SelectedText.Length > 0)
            MessageBox.Show("Nothing to copy!");
    private void btnPaste_Click(object sender, RoutedEventArgs e)
        if (Clipboard.ContainsText())
            txtPaste.Text = Clipboard.GetText();

    Note you can also use system clipboard (so text from outside Silverlight works as well), and you can use ctrl+c / ctrl+v instead of the buttons.

    Download source code

    (requires Silverlight 4 beta)

    Technorati Tags:


  • Silverlight 4 Implicit Styling

    Silverlight 4One of the cool new features of Silverlight 4 is Implicit Styling: you can now theme your application without resorting to the ImplicitStyleManager from the toolkit.

    For that you just create Styles in resource and do not specify x:keys (just the TargetType).

    Code Sample for a Button:

        <Style TargetType="Button">
            <Setter Property="FontSize" Value="24"></Setter>
            <Setter Property="Background" Value="Red"></Setter>
            <Setter Property="Foreground" Value="#FFAA3434"></Setter>

    Now every Button in your app get styled, no need to specify a style key from resource:


    Speaking about resource, did you see that VS2010 has an “Extract Value to Resource…” feature on the properties window ?

    Then it asks you where you want to store that resource (current page, app.xaml, …). Unfortunately you can’t extract multiple properties at the same time to create a new Style… but this is still beta, right?

    Remember Silverlight 4 beta is a developer release only (the public runtime is not available for this release) so my previous post on ImplicitStyleManager is still valid for your current Silverlight 3 apps, waiting for Silverlight 4 to ship!

    Technorati Tags:


  • Silverlight 4 beta released!

    Silverlight 4 Silverlight 4 beta was announced by Scott Guthrie a few minutes ago during his keynote at PDC 2009.

    So only 4 months after Silverlight 3 released, we have a new version to play with!!

    Silverlight 4 brings several interesting features:

    • Webcam/mic support
    • Printing API
    • MouseWheel on common controls
    • Implicit Styles
    • Controls: RichTextBox, ViewBox and WebBrowser
    • DataBinding improved
    • CLR 4.0 (compatibility with dll from the Full .NET 4.0)
    • and much much more!!!… see full list below

    Notice that from the top 10 features request list, 8 out of 10 were addressed, that’s awesome!!!

    Silverlight gain maturity for business applications with additions like Printing, MouseWheel, Clipboard, Right click and File Drop.

    Several tools have been updated to support Silverlight 4 beta development:

    Detailed list of Silverlight 4 new features:

    • WebCam/Microphone
    • Printing Support
    • Media
      • WMS Multicast Support
      • H.264 Mp4 Playback Protected by PlayReady DRM
      • Offline DRM
      • Output Protection
    • Text
      • RichTextBox control
      • Bidi Support (including Arabic and Hebrew Text)
      • UIElement.TextInput event
      • IME Improvements for TextBox
    • Controls
      • Implicit Styles (type based style theming – no longer a need to explicitly set styles on controls)
      • Built-in MouseWheel Support on ScrollViewer, TextBox, ComboBox, Calendar, DatePicker
      • ViewBox
      • ICommanding Support with ButtonBase & Hyperlink
      • SelectedValue and SelectedValuePath Properties on DropDownLists
      • RTL Layout via UIElement.FlowDirection property
      • VisualStateGroup.CurrentStateGroup property
    • DataBinding
      • DataBinding Support for DependencyObjects
      • IDataErrorInfo Support
      • StringFormat, TargetNullValue & FallBackValue Properties on Binding
      • ObservableCollection<T> ctor that takes INumerable or Ilist
    • Networking
      • UDPListener and Multi-cast support
      • Memory Usage Fix During Progressive Downloads
      • Automatically Adding Referer Header
      • Astoria 2.0 Support
      • WCF RIA Services
      • WCF Improvements
    • Out of Browser Applications
      • HTML Hosting Support
      • Windowing APIs (resize window, etc)
      • Notifications (Outlook-like popup windows that can display even when OOB app is minimized)
      • Elevated Privileges Support
        • Cross Domain Networking Access
        • Full file path from Open/SaveFileDialog and File Manipulation APIs
        • No User-Initiation Requirement for Full Screen, Open/SaveFileDialogs
        • COM interop (allowing you to create and use any COM object on Windows)
    • CLR 4.0  Engine
      • NGEN Support for Core Runtime Binaries (faster startup and execution of apps)
      • Dynamic keyword support in C# 4.0 and COM interop when running elevated out of browser applications
      • MEF – Managed Extensibility Framework
      • Binary assembly compat between assemblies that run on SL and on full .NET 4.0 CLR (no recompile needed now starting with .NET 4 Beta2)
    Technorati Tags: