Welcome to Pete Brown's 10rem.net

First time here? If you are a developer or are interested in Microsoft tools and technology, please consider subscribing to the latest posts.

You may also be interested in my blog archives, the articles section, or some of my lab projects such as the C64 emulator written in Silverlight.

(hide this)

Silverlight Quick Tip: Controlling the Out-of-Browser Window

Pete Brown - 03 February 2010

If your Silverlight 4 application is running with Elevated Permissions, you can control a fair number of aspects of the hosting out-of-browser window. You can change the size, location, make it top most, set window state and Activate it. Here’s some simple example code:

if (Application.Current.HasElevatedPermissions)
{
    Window win = Application.Current.MainWindow;

    win.WindowState = WindowState.Normal;

    win.TopMost = true;
    win.Height = 200;
    win.Width = 200;

    win.Left = 150;
    win.Top = 150;

    if (!win.IsActive)
        win.Activate();
    
}

Of course, use good judgment when moving the window around, or making it top-most.

   
posted by Pete Brown on Wednesday, February 3, 2010
filed under:    

4 comments for “Silverlight Quick Tip: Controlling the Out-of-Browser Window”

  1. Pete Brownsays:
    For RTM, I believe you'll be able to control the chrome. That likely means borderless window with an optional corner radius and custom titlebars of your design. I don't believe we'll support non-rectangular windows, but can't say for sure.
  2. Bill Storagesays:
    It doesn't appear that there is a means of detecting that the OOB window has been minimized, i.e., no WindowStateChanged event and no notification of minimizing via SizeChanged. Notification of state change would really be useful.

Comment on this Post

Remember me

1 trackback for “Silverlight Quick Tip: Controlling the Out-of-Browser Window”

  1. uberVU - social commentssays:
    This post was mentioned on Twitter by Pete_Brown: Blogged: Silverlight Quick Tip: Controlling the Out-of-Browser Window http://bit.ly/akSUbG #silverlight #elevated