public static void Detach(ControlAdornerDragDrop dd) { if (dd == null || dd._adorner == null || dd._adorner.Child == null) { return; } dd._element = null; dd._adorner.Child.MouseLeftButtonDown -= dd.MouseLeftButtonDown; dd._adorner.Child.MouseLeftButtonUp -= dd.MouseLeftButtonUp; dd._adorner.Child.MouseMove -= dd.MouseMove; }
private void CreateAdorner() { if (_adorner != null || (Application.Current.MainWindow is null && _userDefinedAdorner is null)) { return; } var adornedElement = GetAdornerElement(); if (adornedElement is null) { return; } var layer = AdornerLayer.GetAdornerLayer(adornedElement); if (layer is null) { return; } _isPositionCalculated = false; var ad = new ControlAdorner(adornedElement) { Child = this, Focusable = false }; KeyboardNavigation.SetTabNavigation(ad, KeyboardNavigationMode.None); layer.Add(ad); BringFluentRibbonBackstageToFront(layer, adornedElement); _adorner = ad; _adornerLayer = layer; if (IsPinned && _adornerDragDrop is null) { _adornerDragDrop = ControlAdornerDragDrop.Attach(_adorner, _dragGrip); } RegisterBeingInFront(); }
public void BringToFront() { if (IsInFront()) { return; } if (!IsPinned || _adorner is null) { return; } if (_adornerDragDrop != null) { ControlAdornerDragDrop.Detach(_adornerDragDrop); _adornerDragDrop = null; } _adornerLayer.Remove(_adorner); var adornedElement = GetAdornerElement(); if (adornedElement is null) { return; } _adornerLayer = AdornerLayer.GetAdornerLayer(adornedElement); if (_adornerLayer is null) { return; } _adornerLayer.Add(_adorner); BringFluentRibbonBackstageToFront(_adornerLayer, adornedElement); if (IsPinned && _adornerDragDrop is null) { _adornerDragDrop = ControlAdornerDragDrop.Attach(_adorner, _dragGrip); } RegisterBeingInFront(); }
public static ControlAdornerDragDrop Attach(ControlAdorner adorner, UIElement element) { if (adorner == null || adorner.Child == null) { return null; } var dd = new ControlAdornerDragDrop { _adorner = adorner, _element = element }; dd._adorner.Child.MouseLeftButtonDown += dd.MouseLeftButtonDown; dd._adorner.Child.MouseLeftButtonUp += dd.MouseLeftButtonUp; dd._adorner.Child.MouseMove += dd.MouseMove; return dd; }
public static ControlAdornerDragDrop Attach(ControlAdorner adorner, UIElement element) { if (adorner == null || adorner.Child == null) { return(null); } var dd = new ControlAdornerDragDrop { _adorner = adorner, _element = element }; dd._adorner.Child.MouseLeftButtonDown += dd.MouseLeftButtonDown; dd._adorner.Child.MouseLeftButtonUp += dd.MouseLeftButtonUp; dd._adorner.Child.MouseMove += dd.MouseMove; return(dd); }
private void RemoveAdorner() { if (_adorner == null || _adornerLayer == null) { return; } if (_adornerDragDrop != null) { ControlAdornerDragDrop.Detach(_adornerDragDrop); _adornerDragDrop = null; } _adornerLayer.Remove(_adorner); _adorner.Child = null; _adorner = null; _adornerLayer = null; RegisterBeingMovedOut(); }
private void OnIsPinnedChanged() { if (IsPinned) { if (_adornerDragDrop == null && _adorner != null) { _adornerDragDrop = ControlAdornerDragDrop.Attach(_adorner, _dragGrip); } StopTimer(); } else { if (_adornerDragDrop != null) { ControlAdornerDragDrop.Detach(_adornerDragDrop); _adornerDragDrop = null; } Hide(); } IsPinnedChanged.SafeInvoke(this); }
private void CreateAdorner() { if (_adorner != null || (Application.Current.MainWindow == null && _userDefinedAdorner == null)) { return; } var adornedElement = GetAdornerElement(); if (adornedElement == null) { return; } var layer = AdornerLayer.GetAdornerLayer(adornedElement); if (layer == null) { return; } _isPositionCalculated = false; var ad = new ControlAdorner(adornedElement) { Child = this, Focusable = false }; KeyboardNavigation.SetTabNavigation(ad, KeyboardNavigationMode.None); layer.Add(ad); _adorner = ad; _adornerLayer = layer; if (IsPinned && _adornerDragDrop == null) { _adornerDragDrop = ControlAdornerDragDrop.Attach(_adorner, _dragGrip); } RegisterBeingInFront(); }
public void BringToFront() { if (IsInFront()) { return; } if (IsPinned && _adorner != null) { if (_adornerDragDrop != null) { ControlAdornerDragDrop.Detach(_adornerDragDrop); _adornerDragDrop = null; } _adornerLayer.Remove(_adorner); var adornedElement = GetAdornerElement(); if (adornedElement == null) { return; } _adornerLayer = AdornerLayer.GetAdornerLayer(adornedElement); if (_adornerLayer == null) { return; } _adornerLayer.Add(_adorner); if (IsPinned && _adornerDragDrop == null) { _adornerDragDrop = ControlAdornerDragDrop.Attach(_adorner, _dragGrip); } RegisterBeingInFront(); } }