title: WPF - How do I use the UserControl with a dependency property and view model?
body: <p>My goal is to have a user select a year and a month. Translate the selection into a date and have the user control send the date back to my view model. That part works for me....However, I cannot get the ViewModel's initial date to set those drop downs. </p>
  
  <pre><code>   public static readonly DependencyProperty Date =
        DependencyProperty.Register("ReturnDate", typeof(DateTime), typeof(DatePicker),
        new FrameworkPropertyMetadata{BindsTwoWayByDefault = true,});
  
     public DateTime ReturnDate
       {
          get { return Convert.ToDateTime(GetValue(Date)); }
          set
          {
              SetDropDowns(value);
              SetValue(Date, value);
          }
       }
  </code></pre>
  
  <p>The SetDropDowns(value) just sets the selected items on the combo boxes, however, the program never makes it to that method. </p>
  
  <p>On the view I am using:</p>
  
  <pre><code>  &lt;cc1:DatePicker ReturnDate="{Binding Path=StartDate, Mode=TwoWay}" IsStart="True" /&gt;
  </code></pre>
  
  <p>If this has been answered, then my bad. I looked around and didn't see anything that worked for me. Thus, when the program loads how do I get the value from the view model to a method in order to set the combo boxes?</p>
  
  <p>Thanks,</p>
  
  <p>-Scott</p>