title: Dependency property callback on datagrid custom column not firing
body: <p>I have the following custom datagrid column, for passing in the value of the <code>DatePart</code> dependency property as the <code>ConverterParameter</code> to the editing element's converter:
  </p>
  
  <pre><code>Public Class DataGridTimeColumn
      Inherits DataGridTextColumn
  
      Shared ReadOnly DatePartProperty = DependencyProperty.Register("DatePart", GetType(DateTime?), GetType(DataGridTimeColumn), New FrameworkPropertyMetadata(Nothing, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, AddressOf RefreshBinding))
      Property DatePart As DateTime?
          Get
              Return GetValue(DatePartProperty)
          End Get
          Set(value As DateTime?)
              SetValue(DatePartProperty, value)
          End Set
      End Property
  
      Private Shared Sub RefreshBinding(d As DependencyObject, e As DependencyPropertyChangedEventArgs)
          Dim tc As DataGridTimeColumn = d
          tc.Binding = tc.Binding
      End Sub
  
      Public Overrides Property Binding As BindingBase
          Get
              Return MyBase.Binding
          End Get
          Set(value As BindingBase)
              Dim b As Data.Binding = value
              With b
                  .Converter = New TimeConverter
                  .ConverterParameter = DatePart
              End With
              MyBase.Binding = b
          End Set
      End Property
  End Class
  </code></pre>
  
  <p>With the following XAML:
  </p>
  
  <pre><code>&lt;my:DataGridTimeColumn Header="From" Binding="{Binding FromDate}" DatePart="{Binding FromDate}" /&gt;
  &lt;my:DataGridTimeColumn Header="Until" Binding="{Binding TillDate}" DatePart="{Binding TillDate}" /&gt;
  </code></pre>
  
  <p>But <code>RefreshBinding</code> is never called (I've set a breakpoint and it's never triggered), and thus <code>DatePart</code> is always <code>Nothing</code>(<code>null</code>) when the <code>ConverterParameter</code> is set. How can I fix this?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>In C#:
  </p>
  
  <pre><code>public class DataGridTimeColumn : DataGridTextColumn
  {
      static readonly DependencyProperty DatePartProperty = DependencyProperty.Register(
          "DatePart", typeof(DateTime?), typeof(DataGridTimeColumn),
          new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, RefreshBinding)
      );
  
      public DateTime? DatePart
      {
          get { return (DateTime?)GetValue(DatePartProperty); }
          set { SetValue(DatePartProperty, value); }
      }
  
      private static void RefreshBinding(DependencyObject d, DependencyPropertyChangedEventArgs e) 
      {
          var tc = (DataGridTimeColumn)d;
          tc.Binding = tc.Binding;
      }
  
      public override System.Windows.Data.BindingBase Binding
      {
          get { return base.Binding; }
          set
          { 
              var b = (Binding)value;
              b.Converter = new TimeConverter();
              b.ConverterParameter = DatePart;
              base.Binding = b;
          }
      }
  }
  </code></pre>