开发者

New window in Silverlight out-of-browser application

In a Silverlight application that doesn't run in a browser, is it possible to create a new top-level window? Or at least a child window?

I found some solution using the ChildWindow class, but even though my project is configured for Silverlight 4, that class can not be found.

I have a UserControl (XAML file) that I want to show as a new window. Using a tab control is not really an option 开发者_JAVA百科unfortunately as the user has to be able to arrange windows to see more than one at once.

Any suggestions?


ChildWindow is part of the SDK, you need to add the System.Windows.Controls.dll to access the ChildWindow type.

I'm not sure you can get the ChildWindow to do what you are expecting. A ChildWindow is designed to present a window in a modal manner. However this modal behaviour is really a function of the ChildWindow template. It is possible to re-template to remove the modal behaviour. However I've never tried to manipulate multiple child windows. You could give it a go, the big question would be what happens if you close Child windows in a different order in which they were created?

In order to use a ChildWindow to present your UserControl it would probably be best for you to derive from ChildWindow, instead of UserControl. You may even find it would ultimately be better for you create base class between your specific Xaml and ChildWindow where you would put code that is common to all your windows.

I might be worth you noting the Silverlight 5 will support multiple windows.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜