Hi Jason,
We are using July 08, 2014 nightly build, version 6.0
the following code is used for column EditingTemplate for date time field in the DataGrid:
protected DataTemplate EditDateTimeTemplate(string propertyName, bool isReadonly)
{
if( isReadonly )
{
return null;
}
Binding selectedItemBinding = new Binding(propertyName);
selectedItemBinding.Mode = BindingMode.TwoWay;
selectedItemBinding.UpdateSourceTrigger = UpdateSourceTrigger.LostFocus;//UpdateSourceTrigger.PropertyChanged;
FrameworkElementFactory editFactory = new FrameworkElementFactory(typeof(DropDownDatePicker));
editFactory.SetBinding(DropDownDatePicker.ValueProperty, selectedItemBinding);
editFactory.SetValue(DropDownDatePicker.FormatProperty, DateTimePickerFormat.Custom);
editFactory.SetValue(DropDownDatePicker.CustomFormatProperty, dateTimeFormat);
editFactory.SetValue(DropDownDatePicker.CloseOnSelectProperty, true);
editFactory.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Left);
editFactory.SetValue(Control.HorizontalContentAlignmentProperty, HorizontalAlignment.Left);
DataTemplate editTemplate = new DataTemplate();
editTemplate.VisualTree = editFactory;
return editTemplate;
}
When user go to select the date time, by clicking "Month Arrow back/forward" multiple times and then click on word between the back/forward arrows (see image ClickDropDownDateTimeOrder.jpg). The crashes happens and source information is as follows: (you may need to repeat a few time for it to happen)
System.InvalidOperationException: 'System.Windows.Documents.Run' is not a Visual or Visual3D.
at MS.Internal.Media.VisualTreeUtils.AsVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
at System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject reference)
at Mindscape.WpfElements.VisualTreeUtils.FindAncestor[T](DependencyObject from) in D:\nobackup\CmostPlusProjects\MindScape Source\Src\WpfControls\Utilities\VisualTreeUtils.cs:line 27
at Mindscape.WpfElements.DataGrid.IsMouseOverCheckBox() in D:\nobackup\CmostPlusProjects\MindScape Source\Src\WpfControls\DataGrid.cs:line 3414
at Mindscape.WpfElements.DataGrid.OnCellMouseDown(DataGridCellContainer cell) in D:\nobackup\CmostPlusProjects\MindScape Source\Src\WpfControls\DataGrid.cs:line 3436
at Mindscape.WpfElements.WpfDataGrid.DataGridCellContainer.DataGridCellContainer_MouseDown(Object sender, MouseButtonEventArgs e) in D:\nobackup\CmostPlusProjects\MindScape Source\Src\WpfControls\DataGrid\DataGridCellContainer.cs:line 85
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.ContentElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
Thanks, Gordon