DragThumb.cs 697 B

12345678910111213141516171819202122232425262728
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using System.Windows.Input;
  4. namespace SHJX.Service.WorkFlowEdit
  5. {
  6. public class DragThumb: Control
  7. {
  8. public DragThumbKinds Kind { get; set; }
  9. protected Point? MouseDownPoint { get; set; }
  10. protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e)
  11. {
  12. if (e.ChangedButton == MouseButton.Left)
  13. {
  14. var item = this.DataContext as DiagramItem;
  15. var view = VisualHelper.FindParent<DiagramView>(item);
  16. if (item != null && view != null)
  17. {
  18. MouseDownPoint = e.GetPosition(view);
  19. view.DragTool.BeginDrag(MouseDownPoint.Value, item, this.Kind);
  20. e.Handled = true;
  21. }
  22. }
  23. }
  24. }
  25. }