private static void OnContentMarginChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MoneyDataGrid md = d as MoneyDataGrid; if (md != null) { md.OnContentMarginChanged(); } }
protected override void OnPreviewMouseMove(MouseEventArgs e) { MoneyDataGrid grid = this; if (mouseDown && !dragging && grid.SelectedItem != null && !e.Handled && SupportDragDrop) { Point pos = e.GetPosition(grid); if ((pos - downPosition).Length > Threshold) { TextBox hit = null; if (IsEditing) { HitTestResult result = VisualTreeHelper.HitTest(grid, pos); if (result != null && result.VisualHit != null) { hit = WpfHelper.FindAncestor <TextBox>(result.VisualHit); } } if (hit != editBox || !IsEditing) { // we have moved outside the current row, so must be trying to do a drag/drop try { e.Handled = true; CommitEdit(); DragDrop.DoDragDrop(grid, grid.SelectedItem, System.Windows.DragDropEffects.All); StopAutoScrolling(); } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } dragging = false; mouseDown = false; editBox = null; } } }