Silverlight 4’s New Managed Extensibility Framework

One of the less-talked-about features of Silverlight 4 is the new Managed Extensibility Framework, or MEF. MEF has been evolving on CodePlex for a while now. It’s slated to be integrated into .NET 4.0 and Silverlight 4, and as such is something with which developers should be familiar. As its name implies, MEF is a framework…

Silverlight 4’s New HTML Hosting Support

Another of the new capabilities that Silverlight 4 brings to the platform is the ability to host HTML content inside a Silverlight control. This support isn’t limited to static HTML content; the content can be interactive and can include script. It can even be Flash content or content that includes other Silverlight controls. To host…

Silverlight’s Big Image Problem (and What You Can Do About It)

Quick: Can you spot the problem with these three lines of code? BitmapImage bi = new BitmapImage(); bi.SetSource(stream); TheImage.Source = bi; These statements create an image from a stream of PNG or JPG image bits and display the image by assigning it to a XAML Image object named TheImage. It’s boilerplate code used to display images read…

Silverlight 4’s New Local File System Support

In my last blog post, I wrote about Silverlight 4 applications that run outside the browser with elevated permissions and their ability to leverage COM automation servers on the host PC. Another privilege that applications with elevated permissions—also known as “trusted apps”—enjoy is the ability to access parts of the local file system without prompting the…

Silverlight 4’s New COM Automation Support

One of Silverlight 4’s most compelling new features is support for out-of-browser applications with elevated permissions. An app running with elevated permissions can perform actions that a normal sandboxed application can not. For example, it can access the local file system, and on Windows boxes, it can interact with COM automation servers. This latter feature—also…

Silverlight 4’s New Commanding Support

One of the exciting new features in the Silverlight 4 beta is a pair of properties added to the ButtonBase and Hyperlink classes named Command and CommandParameter. These properties represent the first real support in Silverlight for commanding, which is primarily beneficial to to Model-View-ViewModel (MVVM) applications. MVVM has long been popular among WPF developers…

Silverlight 4’s New Drag-and-Drop Support

Another new feature of Silverlight 4 that will enable developers to build richer UIs is drag-and-drop file support. In Silverlight 3, you had to pop up an OpenFileDialog to allow the user to select files from the local file system and make them available to a Silverlight application. In Silverlight 4, OpenFileDialog still works, but there…

Silverlight 4’s New Clipboard Support

Among the many new features coming in Silverlight 4 is clipboard support. A new class named System.Windows.Clipboard provides three static methods for accessing the system clipboard: GetText, which retrieves text from the clipboard SetText, which places text on the clipboard ContainsText, which indicates whether the clipboard currently contains text In the Silverlight 4 beta, only Unicode text…

Silverlight 4’s Improved Element Data Binding

Earlier this year, I wrote about Silverlight 3’s new element data binding feature, which enables XAML elements to be bound together declaratively. I also bemoaned the fact that the target of an element-to-element data binding had to be a Framework-element derivative. Good news! Silverlight 4 fixes this by extending element data binding to DependencyObject derivatives.…

Silverlight 4’s New Implicit Styles

Silverlight 4 introduces a boatload of big-ticket features such as printing support, webcam and microphone support, and support for elevated trust in out-of-browser applications. It’s also chock full of minor improvements that fly lower under the radar. One of my favorite features in this category is support for implicit styles. In Silverlight 3, there was…

Silverlight 3’s New Application Extension Services

Another feature of Silverlight 3 that has flown under the radar since the product’s release is application extension services, or application services for short. Application services are client-side services that start when the application starts and end when the application ends. In other words, their lifetime parallels that of the application itself. An application service is…

Silverlight 3’s New {RelativeSource} Markup Extension

One of the more obscure features introduced in Silverlight 3 is the {RelativeSource} markup extension. It’s poorer than its counterpart in WPF because the Silverlight version supports only two modes: Self and TemplatedParent. There are precious few examples out there demonstrating why you’d ever need {RelativeSource} in Silverlight. Here’s one example. Suppose you’re building a custom control…