title: WPF Best Practices: Do custom controls work well with the MVVM design?
body: <p>I was looking at creating a common control that I will be able to reuse on my pages: an AddressControl which has Address1, Address2, City, State, Zip, etc...</p>
  
  <p>Originally I just created a class (<code>AddressEntity</code>) that contained all these items and implemented <code>INotifyPropertyChanged</code>. I included that class as a DependencyProperty in my Code-Behind for the AddressControl and used it as the DataContext for the bindings to its properties.</p>
  
  <p>Then, someone said my code was ugly and I should look into MVVM. Looking at it, I assume that:</p>
  
  <ul>
  <li>AddressEntity.cs will just be a container of data (i.e. Address1, Address2, etc.) and members (i.e. Clone, ToString, etc.)</li>
  <li>I need some AddressViewModel to wrap my AddressEntity in and provide the PropertyNotification Changes, Validation, etc.</li>
  <li>I need to somehow have a "View" for this.</li>
  </ul>
  
  <p>The problem is every example I've ever seen has a UserControl as the View and not a CustomControl. Before I delve too deep into this...</p>
  
  <ul>
  <li>Is it possible to use MVVM + Custom Controls for this example?</li>
  <li>Is it pretty much the same thing (UserControl vs CustomControl) as the View with the exception of primary differences of UserControl vs CustomControl? Basically, is my CustomControl really just a View?</li>
  </ul>
  
  <p>References: <a href="https://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090006" rel="nofollow noreferrer">The Model-View-ViewModel (MVVM) Design Pattern for WPF</a></p>