视图之间的通信
我对如何设置视图之间的消息传递有点困惑。我正在做的是在我的主页中使用 radtabcontrol。此后启动的每个视图都绑定到一个新选项卡。当需要终止选项卡时,即用户请求关闭或不再需要它时,我需要与主页通信,以便它可以终止视图并关闭选项卡。
有人可以帮我找到教程或者提供使用 Messenger 和 RelayCommand 来执行此操作的示例代码吗?
I am abit confused about how to setup the messaging between views. What I am doing is using a radtabcontrol in my mainpage. Each view that is launched after that is bound to a new tab. When the tab needs to be terminated, i.e. user requests a close or it is no longer required, I need to communicate back to the mainpage so it can terminate the view and close the tab.
Can someone help me find a tutorial or perhaps provide sample code using Messenger and RelayCommand to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 MainPage(或其他)的构造函数中:
MessageReceived 方法(也在 MainPage 中):
然后,当您需要发送消息时(可能在您的选项卡视图或其 ViewModel 中):
In the constructor of your MainPage (or whatever):
The MessageReceived method (also in MainPage):
Then when you need to send the message (maybe in your tab Views or their ViewModels):