title: Dependency Property Binding in UserControl
body: <p>My solution is implemented in MVVM. The view is a window which hosts a usercontrol. I have created a dependency property for this userControl as below :</p>
  
  <pre><code>public static DependencyProperty ListProperty = DependencyProperty.Register(
        "ItemsList", typeof(List&lt;RequiredClass&gt;), typeof(UsercontrolTest));
  
  public List&lt;RequiredClass&gt; ItemsList
  {
      get { return (List&lt;RequiredClass&gt;)GetValue(ListProperty); }
      set
      {
          SetValue(ListProperty, value);
      }
  }
  </code></pre>
  
  <p>This property is bound to my viewmodel property (ListOfItems) in xaml :</p>
  
  <pre><code>  &lt;Window x:Class="TestProject.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:Test="clr-namespace:TestProject"
            Title="MainWindow" Height="350" Width="525"&gt;
      &lt;Grid&gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition&gt;&lt;/RowDefinition&gt;             
              &lt;RowDefinition&gt;&lt;/RowDefinition&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;Test:UserControlTest Grid.Row="0" ItemsList="{Binding Path=ListOfItems}" /&gt; 
          &lt;Button Grid.Row="1" Content="AddItems" Click="Button_Click" /&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>Also I have initialized the datacontext of the window in codebehind to the viewmodel. Problem is the binding never seems to happen and the set property is never called for the dependency property. Am I missing something here?</p>