在PRISM 4中导航到新视图时如何传递对象 [英] How to Pass an object when navigating to a new view in 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一起传递的对象.这些被存储在哈希表中,当在棱镜中导航时,我将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屋!