显示/隐藏主窗口 [英] Show/Hide the Main window

查看:117
本文介绍了显示/隐藏主窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在wpf(xaml)中
我可以隐藏主窗口[在我使用this.hide()的主窗口中)并显示另一个窗口(例如NewWin)
但我想在NewWin中再次显示Main?
我该怎么办?:confused:

感谢您的帮助,您说监听事件的主窗口",但我该怎么办? 我应该怎么做(请提供一些代码段)

In wpf (xaml)
I can hide the main window [in main window I used this.hide() ] and show another window( for example NewWin)
but I want to show the Main again in NewWin ?
How can I do that?:confused:

Thanks for help, you said " the main window that listens for that event " but how can I do that ?,could you tell exactly
what should I do ( with some snippet code please)

推荐答案

您可以使用以下代码显示主窗口.
You can use the following code to show the main window.
App.Current.MainWindow.Show()


谢谢,
Vineeth


Thanks,
Vineeth


您可以通过多种方法来执行此操作.一种方法是在NewWin上创建一个事件,然后将其命名为TellParentToOpen.然后,当您创建NewWin时,在侦听该事件的主窗口内添加一个事件处理程序.发生时,显示主窗口.

然后,只需要在希望显示窗口时从NewWin引发该事件即可.
There are a number of ways that you could do this. One would be to create an event on the NewWin and call it something like TellParentToOpen. Then, when you create the NewWin, add an event handler within the main window that listens for that event. When it occurs, show the main window.

Then, you just have to raise that event from NewWin when you want the window to show.


这篇关于显示/隐藏主窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆