Пример #1
0
        private void OnGotFocus(object sender, RoutedEventArgs args)
        {
            _adorner = new ResizingAdorner(this, _desiredSize);
            _adorner.DesiredSizeChanged += OnDesiredSizeChanged;

            var adornerLayer = AdornerLayer.GetAdornerLayer(this);

            if (adornerLayer != null)
            {
                adornerLayer.Add(_adorner);
            }
        }
Пример #2
0
        private void OnLostFocus(object sender, RoutedEventArgs args)
        {
            if (_adorner == null)
            {
                Debug.Fail("Lost focus without creating an adorner");
                return;
            }

            _adorner.DesiredSizeChanged -= OnDesiredSizeChanged;

            var adornerLayer = AdornerLayer.GetAdornerLayer(this);

            if (adornerLayer != null)
            {
                adornerLayer.Remove(_adorner);
                _adorner = null;
            }
        }
Пример #3
0
        private void OnGotFocus(object sender, RoutedEventArgs args) {
            _adorner = new ResizingAdorner(this, _desiredSize);
            _adorner.DesiredSizeChanged += OnDesiredSizeChanged;

            var adornerLayer = AdornerLayer.GetAdornerLayer(this);
            if (adornerLayer != null) {
                adornerLayer.Add(_adorner);
            }
        }
Пример #4
0
        private void OnLostFocus(object sender, RoutedEventArgs args) {
            if (_adorner == null) {
                Debug.Fail("Lost focus without creating an adorner");
                return;
            }

            _adorner.DesiredSizeChanged -= OnDesiredSizeChanged;

            var adornerLayer = AdornerLayer.GetAdornerLayer(this);
            if (adornerLayer != null) {
                adornerLayer.Remove(_adorner);
                _adorner = null;
            }
        }