title: MVVM using WPF and C#
body: <p>I've recently moved from WinForms to WPF and I'm finding it hard to separate ViewModel and View. I'm designing the entire view in the ViewModel. Eventhough it works, I'm sure it is not the right way. </p>
  
  <p>Is there anyway I can separate View and ViewModel without modifying much? I've did some research on it, but it wasn't that helpful.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>XAML </p>
  
  <pre><code>&lt;Window x:Class="PackageDeliveryTool.FolderCheck"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Main Window" Height="350" Width="640" ResizeMode="NoResize" ShowInTaskbar="False" Topmost="True" Cursor="Arrow" Closing="Window_Closing"&gt;
  &lt;!-- From here is the XAML view code which includes button/Grid/StackPanel etc --&gt;
      &lt;/Window&gt;
  </code></pre>
  
  <p>And I have separate CS file for model. which has properties and propertyChanged Events.</p>
  
  <p>This is XAML.Cs file of particular Window. has actions and and Model Object(s),</p>
  
  <pre><code>public partial class CopyMessageWindow : Window
  {
      Model m = new Model("someValue");
      public CopyMessageWindow()
      {
          InitializeComponent();
      }
  
  
      public void StartButton_Click(object sender, RoutedEventArgs e){
          //Some code goes here uses Model instance
      }
  
  public void OtherLogicMethod(int val){
      //Some other logic not related to UI, but to Background program. Also uses Model Instance
      }
  
      private void CancelButton_Click(object sender, RoutedEventArgs e)
      {
          //When cancel button is clicked, uses Model instance
      }
  }
  </code></pre>
  
  <p><strong>EDITx2</strong></p>
  
  <p>I've already written much code. I need a more simplistic way of separating view and ViewModel.</p>