title: Setting up binding to a custom DependencyProperty inside a WPF user control
body: <p>I have a WPF UserControl containing a custom DependencyProperty named MyDP.  I want to bind this to a property on my ViewModel (which is injected as the UserControl's DataContext).  I know one way to do it by setting the binding in the UserControl's declaration in the parent window's XAML as such:</p>
  
  <pre><code>&lt;Window x:Class="MyNamespace.Views.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:views="clr-namespace:MyNamespace.Views"&gt;
      &lt;StackPanel&gt;
          &lt;views:MyControl MyDP="{Binding Path=MyVMProperty, Mode=OneWayToSource}"/&gt;
      &lt;/StackPanel&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>This works fine, but as an alternate could I set up the binding inside the UserControl's XAML, similar to how I set the bindings for the individual controls inside the UserControl to other properties of the ViewModel?  </p>