private void OnLostFocus(object sender, RoutedEventArgs args) { MyParent.PreviewMouseLeftButtonDown -= OnPreviewParentMouseDown; PreviewKeyDown -= OnPreviewKeyDown; adorner.ResizeStarted -= OnResizeStarted; adorner.ResizeCompleted -= OnResizeCompleted; var adornerLayer = AdornerLayer.GetAdornerLayer(MyContent); adornerLayer.Remove(adorner); adorner = null; }
private void OnGotFocus(object sender, RoutedEventArgs args) { MyParent.PreviewMouseLeftButtonDown += OnPreviewParentMouseDown; PreviewKeyDown += OnPreviewKeyDown; adorner = new ResizingAdorner(MyContent); adorner.ResizeStarted += OnResizeStarted; adorner.ResizeCompleted += OnResizeCompleted; var adornerLayer = AdornerLayer.GetAdornerLayer(MyContent); adornerLayer.Add(adorner); }