public static void Detach(PopupDragDrop pdd) { if (pdd == null || pdd._popup == null || pdd._popup.Child == null) { return; } pdd._popup.Child.MouseLeftButtonDown -= pdd.MouseLeftButtonDown; pdd._popup.Child.MouseLeftButtonUp -= pdd.MouseLeftButtonUp; pdd._popup.Child.MouseMove -= pdd.MouseMove; }
public static PopupDragDrop Attach(Popup popup) { if (popup == null || popup.Child == null || !(popup.Child is FrameworkElement)) { return null; } var pdd = new PopupDragDrop { _popup = popup }; pdd._popup.Child.MouseLeftButtonDown += pdd.MouseLeftButtonDown; pdd._popup.Child.MouseLeftButtonUp += pdd.MouseLeftButtonUp; pdd._popup.Child.MouseMove += pdd.MouseMove; return pdd; }
public static PopupDragDrop Attach(Popup popup) { if (popup == null || popup.Child == null || !(popup.Child is FrameworkElement)) { return(null); } var pdd = new PopupDragDrop { _popup = popup }; pdd._popup.Child.MouseLeftButtonDown += pdd.MouseLeftButtonDown; pdd._popup.Child.MouseLeftButtonUp += pdd.MouseLeftButtonUp; pdd._popup.Child.MouseMove += pdd.MouseMove; return(pdd); }