问题描述
我试图找到一种解决方法,当我调用DoClose()时将数据从一个视图模型传回另一个模型.
I'm trying to find a solution to passing back data from a viewmodel to another when I call DoClose()
我有一个视图,用户可以在其中添加信息到edittext中,还有一个按钮可以打开一个新视图,用户可以在其中输入其他信息.然后,他需要返回(DoClose()
)到第一个视图,然后单击该按钮以保存信息.
I've got a view where the user can add informations in edittext, there is also a button that open a new view where the user can enter others informations. Then he need to go back (DoClose()
) to the first view and there click on the button to save informations.
我尝试制作一个RequestNavigate<>
,但是它在堆栈中创建了一个新视图.
I tried to make a RequestNavigate<>
but it create a new view in stack.
我不知道如何从第二个视图中获取信息.有人可以帮助我吗?
I don't know how can I get back the informations from the second view.Someone can help me ?
推荐答案
@gshackles的这篇文章提供了一种实现此目的的机制- http://www.gregshackles.com/2012/11/returning-results-from-view-models-in-mvvmcross/
This article from @gshackles gives one mechanism for doing this - http://www.gregshackles.com/2012/11/returning-results-from-view-models-in-mvvmcross/
这篇关于如何使一个视图模型返回数据到另一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!