Sunday, September 19, 2010

Silverlight, Out-Of-Browser and Multiple Windows

I was talking to a developer the other day about Silverlight out-of-browser applications and how there’s not really any support for opening multiple windows so that (e.g.) you might have a master window in the application and the ability to open sub-windows.
It’s a feature that’s often requested and I think it’s referred to from this request here although that actually asks for MDI which I think you could achieve a form of with Silverlight’s ChildWindow class.
I was wondering how this might be done and got thinking about how it might be possible to have a scheme whereby;
Your main Silverlight application runs.
The user wants to open a new window in the application.
You run a second instance of the application.
The second instance of the application is told to navigate to some content that makes it the second window rather than the primary window.
This is mostly an experimentation rather than something I’d advise, I just wanted to see how it might work.
In The Browser
In the browser, I don’t think this is too difficult and there’s no doubt a number of ways you can do it but you can use HtmlPage.PopupWindow in order to open that second window in step (2) above and you can then navigate that second window to a page within your application.
To experiment with this I put together this little test UI;
Read more: Mike Taulty's Blog