title: How can WPF Converters be used in an MVVM pattern?
body: <p>Let's say I have a View that is bound to <strong>ViewModel A</strong> which has an observable collection <strong>Customers</strong>.</p>
  
  <p>An advantage of this MVVM pattern is that I can also bind the View to <strong>ViewModel B</strong> which fills it with different data.</p>
  
  <p>But what if in my <strong>View converter Converters</strong> to display my customers, e.g. I have a "ContractToCustomerConverter" that accepts a Contract and returns the appropriate Customer to be displayed.</p>
  
  <p>The problem with this is that the converter <strong>exists outside the MVVM pattern</strong> and thus doesn't know that my ViewModel has another source for customers.</p>
  
  <ul>
  <li>is there a way for the <strong>View to pass the ViewModel into the Converter</strong> so that it participates in the decoupling that the MVVM pattern provides?</li>
  <li>is there a way for me to somehow <strong>include the Converter in my ViewModel</strong> so that the converter uses the current dependencies which ViewModel has available?</li>
  <li>or are converters just <strong>glorified code-behind</strong> and thus not used in the MVVM pattern, so if you are using MVVM then you just create your own "converters" (methods on your ViewModel class) which return things like Image objects, Visibility objects, FlowDocuments, etc. to be used on the view, instead of using converters at all?</li>
  </ul>
  
  <p><em>(I came upon these questions after seeing the use of Converters in the WPF demo application that comes with the <a href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14962" rel="noreferrer">MVVM Template Toolkit download</a>, see the "Messenger Sample" after unpacking it.)</em></p>