从ViewModel到View显示错误或信息 [英] Display Error or Information from ViewModel to View

查看:153
本文介绍了从ViewModel到View显示错误或信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在视图模型之间显示错误或信息(Toast,消息框..).

How to display an Error or information (Toast,Message Box..) from view model to view.

注意:我正在为Droid,Touch和Wp8开发一个跨平台应用程序.

Note: I am developing a cross platform application for Droid,Touch and Wp8.

推荐答案

有几种方法可以做到这一点:

There are several ways to do this:

  1. 使用Messenger或自定义对象/事件链将错误事件通知发送到UI.这显示在 https://github.com /MvvmCross/MvvmCross-Tutorials/tree/master/Sample%20-%20BestSellers/BestSellers ,并在提供并使用对话服务"-类似于 https://github提供的服务.com/brianchance/MvvmCross-UserInteraction -为了显示消息

    Provide and use a "dialog service" - like that provided by https://github.com/brianchance/MvvmCross-UserInteraction - in order to show messages

    使用交互模式"(类似于Prism公开的模式)-请参见 Mvvm跨对话框

    Use an "interaction pattern" - like that exposed by Prism - see MvvmCross Dialog

    这篇关于从ViewModel到View显示错误或信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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