LinkThumb.cs 840 B

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