/// <summary>
        /// Called from the DrawingContext when the DrawingContext is closed.
        /// </summary>
        internal override void RenderClose(IDrawingContent newContent)
        {
            IDrawingContent oldContent;

            //
            // First cleanup the old content and the state associate with this node
            // related to it's content.
            //

            oldContent = _content;
            _content   = null;

            if (oldContent != null)
            {
                //
                // Remove the notification handlers.
                //

                oldContent.PropagateChangedHandler(ContentsChangedHandler, false /* remove */);


                //
                // Disconnect the old content from this visual.
                //

                DisconnectAttachedResource(
                    VisualProxyFlags.IsContentConnected,
                    ((DUCE.IResource)oldContent));
            }


            //
            // Prepare the new content.
            //

            if (newContent != null)
            {
                // Propagate notification handlers.
                newContent.PropagateChangedHandler(ContentsChangedHandler, true /* adding */);
            }

            _content = newContent;


            //
            // Mark the visual dirty on all channels and propagate
            // the flags up the parent chain.
            //

            SetFlagsOnAllChannels(true, VisualProxyFlags.IsContentDirty);

            PropagateFlags(
                this,
                VisualFlags.IsSubtreeDirtyForPrecompute,
                VisualProxyFlags.IsSubtreeDirtyForRender);
        }
Beispiel #2
0
 /// <summary>
 /// This method is overrided on Visuals that can instantiate IDrawingContext
 /// Currently, DrawingVisual and UIElement
 /// </summary>
 internal virtual void RenderClose(IDrawingContent newContent)
 {
 }
Beispiel #3
0
        /// <summary>
        /// Called from the DrawingContext when the DrawingContext is closed.
        /// </summary>
        internal override void RenderClose(IDrawingContent newContent)
        {
            IDrawingContent oldContent;

            //
            // First cleanup the old content and the state associate with this node
            // related to it's content.
            //

            oldContent = _content;
            _content = null;

            if (oldContent != null)
            {
                //
                // Remove the notification handlers.
                //

                oldContent.PropagateChangedHandler(ContentsChangedHandler, false /* remove */);


                //
                // Disconnect the old content from this visual.
                //

                DisconnectAttachedResource(
                    VisualProxyFlags.IsContentConnected,
                    ((DUCE.IResource)oldContent));
            }


            //
            // Prepare the new content.
            // 

            if (newContent != null)
            {
                // Propagate notification handlers.
                newContent.PropagateChangedHandler(ContentsChangedHandler, true /* adding */);                
            }

            _content = newContent;


            //
            // Mark the visual dirty on all channels and propagate 
            // the flags up the parent chain.
            //

            SetFlagsOnAllChannels(true, VisualProxyFlags.IsContentDirty);

            PropagateFlags(
                this,
                VisualFlags.IsSubtreeDirtyForPrecompute,
                VisualProxyFlags.IsSubtreeDirtyForRender);

        }