Example #1
0
        /// <summary>
        /// Set the Visual parent of this ContentElement.
        /// </summary>
        /// <remarks>
        ///     This is different than Visuals.  For Visuals, you have to
        ///     Add/Remove the visual from a children collection to change
        ///     the parent.  I think it is a better model, but I don't
        ///     know if we want to expose a full children collection for
        ///     content elements.
        /// </remarks>
        public static void SetParent(ContentElement reference, DependencyObject parent)
        {
            if(reference == null)
            {
                throw new ArgumentNullException("reference");
            }

            DependencyObject oldParent = reference._parent;
            reference._parent = parent;

            // Raise content parent changed notification
            reference.OnContentParentChanged(oldParent);
        }
Example #2
0
        /// <summary>
        /// Set the Visual parent of this ContentElement.
        /// </summary>
        /// <remarks>
        ///     This is different than Visuals.  For Visuals, you have to
        ///     Add/Remove the visual from a children collection to change
        ///     the parent.  I think it is a better model, but I don't
        ///     know if we want to expose a full children collection for
        ///     content elements.
        /// </remarks>
        public static void SetParent(ContentElement reference, DependencyObject parent)
        {
            if (reference == null)
            {
                throw new ArgumentNullException("reference");
            }

            DependencyObject oldParent = reference._parent;

            reference._parent = parent;

            // Raise content parent changed notification
            reference.OnContentParentChanged(oldParent);
        }