Ejemplo n.º 1
0
        private void ShowAdorner()
        {
            if (adorner == null)
            {
                AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);

                if (adornerLayer != null)
                {
                    ContentControl designerItem = DataContext as ContentControl;
                    Canvas         canvas       = VisualTreeHelper.GetParent(designerItem) as Canvas;
                    adorner = new ResizeRotateAdorner(designerItem);
                    adornerLayer.Add(adorner);

                    if (ShowDecorator)
                    {
                        adorner.Visibility = Visibility.Visible;

                        var anim = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(.2));
                        adorner.BeginAnimation(OpacityProperty, anim);
                    }
                    else
                    {
                        adorner.Visibility = Visibility.Hidden;
                    }
                }
            }
            else
            {
                adorner.Visibility = Visibility.Visible;

                var anim = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(.2));
                adorner.BeginAnimation(OpacityProperty, anim);
            }
        }