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); }