在 PRISM 4 中导航到新视图时如何传递对象 [英] How to Pass an object when navigating to a new view in PRISM 4

查看:14
本文介绍了在 PRISM 4 中导航到新视图时如何传递对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 PRISM 应用程序,我们在其中深入研究数据(以获取更多详细信息).在我的实现中,我有一个嵌套的 MVVM,当我向下导航树时,我想将模型传递给我新创建的视图.

I am working on a PRISM application where we drill down into the data (to get more details). In my implementation I have a nested MVVM and when I navigate down the tree I would like to pass a model to a my newly created view.

据我所知,目前 PRISM 允许传递字符串,但不允许传递对象.我想知道有什么方法可以解决这个问题.

As far as I know, currently PRISM allows to pass strings, but doesn't allow to pass objects. I would like to know what are the ways of overcoming this issue.

推荐答案

我通常使用一个服务来注册我想要通过 guid 传递的对象.这些存储在哈希表中,当在 prism 中导航时,我将 guid 作为参数传递,然后可用于检索对象.

i usually use a service where i register the objects i want to be passed with a guid. these get stored in a hashtable and when navigating in prism i pass the guid as a parameter which can then be used to retrieve the object.

希望这对你有意义!

这篇关于在 PRISM 4 中导航到新视图时如何传递对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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