On January 19th, I presented an introduction to Silverlight 4 and its new user interface enhancements. Here is the source code and PowerPoint from the talk.
Some takeaways we discussed:
Silverlight 4 now offers more capabilities when applications are installed out-of-browser. To enable this feature, look at the Silverlight project’s Properties. You’ll then see an option for enabling out-of-browser, follow
After selecting this option, view the out-of-browser settings:
Here, you can customize the shortcut name and window title, as well as a description that pops up when you float the mouse over your desktop shortcut. In our demo app, I also set the window size, based on our MainPage user control.
We saw elevated trust in action with Tim Heuer’s Twitter Example, where a WebClient call was made to the Twitter service without the need for a cross-domain policy, and where network credentials were specified.
To demonstrate out-of-browser within our demo app, I added another feature, “Notification Window,” to the demo code. This new feature allows you to pop up a notification box in the lower-right region of the screen, similar to what you see with Microsoft Outlook. In the demo, drop a picture onto the drop target, and you’ll see a window pop up. If you look at the code-behind, you’ll see two samples for setting up the notification window’s content. Note: I intentionally omitted any code forcing you to install the demo as an out-of-browser app. This way, you can try out the notification window in the browser and observe the exception thrown.
You now have access to all of your audio and video devices. When I demo’d this, we had two webcams to choose from. . The first time you select a video device, you’ll see the Silverlight warning box. After you agree to allow the app to use the webcam, you won’t see the warning box again (until you restart the application). I added a Stop button, which returns the video rectangle to a green background.
Improved mouse support
Silverlight 4 now has events for right-click actions, as well as mouse scroll wheel support. I demo’d right-click support by adding a popup window when right-clicking the drop-target button.
You can now drag files from your desktop or file folders to a user interface element. I showed this by setting up a button as a drop-target. This button accepts image files such as png and jpg.
Visual Studio improvements
While this isn’t specifically related to Silverlight 4, Visual Studio 2010 now has a built-in XAML Visualizer. This means you no longer need to open Expression Blend simply to layout your user controls. Blend still has a considerable feature set beyond that of Visual Studio, but for general layout, the built-in visualizer should be fine.
There are many more features in Silverlight 4, such as the new printing capability and COM support. For a more complete list, check out Tim Heuer’s post, where he provides descriptions or samples for each of the new features.
To get started, visit the Silverlight 4 developer page to grab the latest SDK and Silverlight developer runtime. You’ll also need Visual Studio 2010, which is currently in beta (Beta 2 Ultimate is available here).