コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }