What is the best practice for handling exceptions when using command binding in WPF?

前端 未结 2 1700
粉色の甜心
粉色の甜心 2021-02-09 02:02

I am using the MVVM pattern for a WPF application. In several places I bind commands to input elements in the views as in the following XAML:

2条回答
  •  星月不相逢
    2021-02-09 02:50

    The easiest answer is to simply pop a message box. A more sophisticated approach might be to use a notification service, which displays the message to the user in a manner appropiate to you app, but can be mocked out with a fake service for unit testing.

提交回复
热议问题