开发者

window.Owner (behavior expected)

开发者 https://www.devze.com 2023-01-08 09:00 出处:网络
what am I missing having this code behind on a XAML window // Create a window and make this window its owner

what am I missing having this code behind on a XAML window

// Create a window and make this window its owner Window ownedWindow = new Window(); ownedWindow.Owner = this; ownedWindow.ShowDialog();

I don't see the behavior http://msdn.microsoft.com/en-us/library/system.windows.window.owner.aspx

Once this relationship is established, the following behaviors are exhibited:

•If an owner window is minimized, all its owned windows are minimized as well.

•If an owned window is minimized, its owner is not minimized.

•If an owner window is maximized, both the owner window and its owned windows are restored.

•An owner window can never cover an owned w开发者_C百科indow.

•Owned windows that were not opened using ShowDialog are not modal. The user can still interact with the owner window.

•If you close an owner window, its owned windows are also closed.

•If an owned window was opened by its owner window using Show, and the owner window is closed, the owned window's Closing event is not raised.

TIA


The ShowDialog() method shows the window as a modal dialog, overriding most of this behavior.

You should call Show() instead to show the window as a child window.
Note that Show() is not a blocking call; your next line of code will execute immediately, not after the window is closed.

0

精彩评论

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