protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
 {
     var txt = new TextBlock {VerticalAlignment = VerticalAlignment.Center};
     if (DateFormat != null)
     {
         var dtc = new DateTimeConverter();
         Binding.Converter = dtc;
         Binding.ConverterParameter = DateFormat;
     }
     txt.SetBinding(TextBlock.TextProperty, Binding);
     return txt;
 }
 protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
 {
     var dp = new DatePicker {VerticalAlignment = VerticalAlignment.Stretch};
     if (DateFormat != null)
     {
         IValueConverter dtc = new DateTimeConverter();
         Binding.Converter = dtc;
         Binding.ConverterParameter = DateFormat;
     }
     dp.SetBinding(DatePicker.SelectedDateProperty, Binding);
     return dp;
 }