Silverlight 4 extends the out-of-browser feature to include support for window customization through the Window class.
What this means is that you can turn this:
into this:
Okay, so that's not necessarily much of an improvement, but you get the idea.
Basically, this feature lets you draw the entire window area yourself. You have complete control within the window rectangle (optionally with rounded corners).
This gives you a lot of room for both creativity and abuse. It is your responsibility to take usability into consideration and provide custom UI for common window interactions as appropriate. To help out with this, you can programmatically move, resize, pin, minimize, normalize, maximize, and close the window.
There are also a few limitations to this feature that you should be aware of:
Sample Code
I spent some time recently playing around with this feature while writing a forthcoming Quickstart, and I decided to encapsulate the windowing stuff into a reusable MainWindow control. You can download the VS project here.
The MainWindow control derives from UserControl and is meant to replace the default layout root. It provides the following features:
The usage is almost the same as with a UserControl:
<oob:MainWindow x:Class="OOBWindowDemo.MainPage" xmlns:oob="clr-namespace:OOBWindow;assembly=OOBWindow" ...other attributes... BorderBrush="{StaticResource gradientBrush}"> <Grid x:Name="LayoutRoot" Background="{StaticResource gradientBrush}"> </Grid> </oob:MainWindow>
Some nice things to add to the control would be a full screen button and better styling (such as VSM support for the various window states), but I'll leave that as an exercise for now.
Enjoy!
Karl Erickson
See Also:
Out-of-Browser Support Trusted Applications