コード例 #1
0
        /// <summary>
        /// Removes a visual child from this object.
        /// </summary>
        /// <param name="child">The child object to remove from this object.</param>
        protected internal void RemoveVisualChild(Visual child)
        {
            if (child == null || child.visualParent == null)
            {
                return;
            }

            if (child.visualParent == this)
            {
                child.visualParent = null;
                child.OnVisualParentChangedInternal(this, null);
            }
        }
コード例 #2
0
        /// <summary>
        /// Adds a visual as a child of this object.
        /// </summary>
        /// <param name="child">The child object to add to this object.</param>
        protected internal void AddVisualChild(Visual child)
        {
            if (child == null)
            {
                return;
            }

            if (child.visualParent != null)
            {
                throw new InvalidOperationException(PresentationStrings.VisualAlreadyHasAParent);
            }

            if (child.visualParent != this)
            {
                var oldParent = child.visualParent;
                var newParent = this;

                child.visualParent = newParent;
                child.OnVisualParentChangedInternal(oldParent, newParent);
            }
        }
コード例 #3
0
ファイル: Visual.cs プロジェクト: prshreshtha/ultraviolet
        /// <summary>
        /// Removes a visual child from this object.
        /// </summary>
        /// <param name="child">The child object to remove from this object.</param>
        protected internal void RemoveVisualChild(Visual child)
        {
            if (child == null || child.visualParent == null)
                return;

            if (child.visualParent == this)
            {
                child.visualParent = null;
                child.OnVisualParentChangedInternal(this, null);
            }
        }
コード例 #4
0
ファイル: Visual.cs プロジェクト: prshreshtha/ultraviolet
        /// <summary>
        /// Adds a visual as a child of this object.
        /// </summary>
        /// <param name="child">The child object to add to this object.</param>
        protected internal void AddVisualChild(Visual child)
        {
            if (child == null)
                return;

            if (child.visualParent != null)
                throw new InvalidOperationException(PresentationStrings.VisualAlreadyHasAParent);

            if (child.visualParent != this)
            {
                var oldParent = child.visualParent;
                var newParent = this;

                child.visualParent = newParent;
                child.OnVisualParentChangedInternal(oldParent, newParent);
            }
        }