将一个模块中的一个视图切换到另一个模块中的另一个视图。 [英] Switch one view in one module to another view in the other module.

查看:77
本文介绍了将一个模块中的一个视图切换到另一个模块中的另一个视图。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候。


使用的技能:Prism,MVVM。


我在模块A的视图中有一个按钮。点击它将导航到模块B中的另一个视图。还有一个参数要传递。任何建议 代码片段或示例项目?


我听说过事件发布和订阅等。但不确定细节。

解决方案

您好ardmore,


如果您想使用参数导航不同模块中的视图,请参阅以下代码段。

员工employee = Employees.CurrentItem as Employee; 
if(employee!= null)
{
var navigationParameters = new NavigationParameters();
navigationParameters.Add(" ID",employee.Id);
_regionManager.RequestNavigate(RegionNames.TabRegion,
new Uri(" ModuleBView" + navigationParameters.ToString(),UriKind.Absolute));
}

有关详细信息,请参阅:


https://stackoverflow.com/questions/13344358/switch-between-views-in-different-modules-使用-prism-and-unity


http:// prismlibrary.github.io/docs/wpf/Navigation.html


致以最好的问候,


张龙


Greetings.

Skills used: Prism, MVVM.

I have a button in a view in Module A. Click it will navigate to the other view in Module B. Also there is one parameter to be passed. Any advice of  code snippet or sample project?

I heard about it the event publish and subscription etc. But not sure the details.

解决方案

Hi ardmore,

if you want to navigate view in different module with parameters, please refer to the following code snippets.

Employee employee = Employees.CurrentItem as Employee;
if (employee != null)
{
    var navigationParameters = new NavigationParameters();
    navigationParameters.Add("ID", employee.Id);
    _regionManager.RequestNavigate(RegionNames.TabRegion,
    new Uri("ModuleBView" + navigationParameters.ToString(), UriKind.Absolute));
}

For more information, please refer to:

https://stackoverflow.com/questions/13344358/switch-between-views-in-different-modules-using-prism-and-unity

http://prismlibrary.github.io/docs/wpf/Navigation.html

Best regards,

Zhanglong


这篇关于将一个模块中的一个视图切换到另一个模块中的另一个视图。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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