title: Handling Dialogs in WPF with MVVM
body: <p>In the MVVM pattern for WPF, handling dialogs is one of the more complex operations.  As your view model does not know anything about the view, dialog communication can be interesting.  I can expose an <code>ICommand</code> that when the view invokes it, a dialog can appear.</p>
  
  <p>Does anyone know of a good way to handle results from dialogs? I am speaking about windows dialogs such as <code>MessageBox</code>.</p>
  
  <p>One of the ways we did this was have an event on the viewmodel that the view would subscribe to when a dialog was required.</p>
  
  
  
  <pre class="lang-cs prettyprint-override"><code>public event EventHandler&lt;MyDeleteArgs&gt; RequiresDeleteDialog;
  </code></pre>
  
  <p>This is OK, but it means that the view requires code which is something I would like to stay away from.</p>