Ejemplo n.º 1
0
        // Be sure to call the base class constructor.
        public DragDropImage(UIElement adornedElement)
            : base(adornedElement)
        {
            _child        = new Rectangle();
            _child.Width  = adornedElement.RenderSize.Width;
            _child.Height = adornedElement.RenderSize.Height;

            adornedElement.ApplyAnimationClock(FrameworkElement.OpacityProperty, null);
            double _originalOpacity = adornedElement.Opacity;

            adornedElement.Opacity = 1;
            _child.Fill            = new ImageBrush(ImageProc.GetImage(adornedElement));
            Opacity = _originalOpacity;
            adornedElement.Opacity = 0;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// For use when the adornedElement is not rendered yet and screenshotElement has a similar appearance.
        /// </summary>
        /// <param name="adornedElement"></param>
        /// <param name="screenshotElement"></param>
        public DragDropImage(UIElement adornedElement, UIElement screenshotElement)
            : base(adornedElement)
        {
            _child        = new Rectangle();
            _child.Width  = screenshotElement.RenderSize.Width;
            _child.Height = screenshotElement.RenderSize.Height;

            screenshotElement.ApplyAnimationClock(FrameworkElement.OpacityProperty, null);
            double opacity = screenshotElement.Opacity;

            screenshotElement.Opacity = 1;
            _child.Fill = new ImageBrush(ImageProc.GetImage(screenshotElement));
            screenshotElement.Opacity = opacity;

            adornedElement.Opacity = 0;
        }