How to open a child windows under parent window on menu item click in WPF?

假如想象 提交于 2019-12-09 15:44:02

问题


I am developing an application in C#. I'm using .Net under WPF. I want to open a new child window (like a dialog) and it should open within the main window, just below the menu bar.

However, the newly opened windows is simply showing an OS task bar. How can I open the various new windows(like a dialog box) under the main window?


回答1:


Try this.

MyChildWindow cw = new MyChildWindow();
cw.ShowInTaskbar = false;
cw.Owner = Application.Current.MainWindow;
cw.Show();


来源:https://stackoverflow.com/questions/7373335/how-to-open-a-child-windows-under-parent-window-on-menu-item-click-in-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!