title: Getting an "Type must derive from DependencyObject" error, when I try to to set a TargetUpdated event on a DatePicker
body: <p>I have a XAML DatePicker that is defined as such:</p>
  
  <pre><code>&lt;DatePicker x:Name="startDateDatePicker" Validation.ErrorTemplate="{StaticResource validationTemplate}"
  SelectedDateChanged="window_DatePicker_SelectedDateChanged" Validation.Error="ValidationError"&gt;
      &lt;DatePicker.SelectedDate&gt;
          &lt;Binding Path="startDate" Mode="TwoWay" NotifyOnValidationError="True" ValidatesOnExceptions="True" UpdateSourceTrigger="PropertyChanged"&gt;
              &lt;Binding.ValidationRules&gt;
                  &lt;!-- A couple custom rules. //--&gt;
              &lt;/Binding.ValidationRules&gt;
           &lt;/Binding&gt;
      &lt;/DatePicker.SelectedDate&gt;
  &lt;/DatePicker&gt;
  </code></pre>
  
  <p>I need to attach an event handler in my code behind to <code>Binding.TargetUpdated</code> and <code>Binding.SourceUpdated</code> events on the <code>Binding</code> object in my <code>DatePicker.SelectedDate</code> object.</p>
  
  <p>However, when I re-define my  tag as such:</p>
  
  <pre><code>&lt;Binding Path="startDate" Mode="TwoWay" NotifyOnValidationError="True" ValidatesOnExceptions="True" UpdateSourceTrigger="PropertyChanged" TargetUpdated="BindingTargetUpdated" SourceUpdated="BindingSourceUpdaed"&gt;
  </code></pre>
  
  <p>I get the error messages:</p>
  
  <blockquote>
    <p>The attached property "TargetUpdated" can only be applied to types that are derived from "DependencyObject".</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>The attached property "SourceUpdated" can only be applied to types that are derived from "DependencyObject".</p>
  </blockquote>
  
  <p>What do I need to do to bind to these events?  I understand the error message, but I don't know how it relates to the <code>&lt;DatePicker.SelectedDate&gt;</code> item since it should be a <code>DependencyObject</code>.</p>