예제 #1
0
파일: Panel.cs 프로젝트: shahid-pk/Perspex
        /// <summary>
        /// Requests that the visual children of the panel use another control as their logical
        /// parent.
        /// </summary>
        /// <param name="logicalParent">
        /// The logical parent for the visual children of the panel.
        /// </param>
        /// <param name="children">
        /// The <see cref="ILogical.LogicalChildren"/> collection to modify.
        /// </param>
        void IReparentingControl.ReparentLogicalChildren(ILogical logicalParent, IPerspexList<ILogical> children)
        {
            Contract.Requires<ArgumentNullException>(logicalParent != null);
            Contract.Requires<ArgumentNullException>(children != null);

            _childLogicalParent = logicalParent;
            RedirectLogicalChildren(children);

            foreach (var control in Children)
            {
                ((ISetLogicalParent)control).SetParent(null);
                ((ISetLogicalParent)control).SetParent((IControl)logicalParent);
                children.Add(control);
            }
        }
예제 #2
0
        /// <summary>
        /// Requests that the visual children of the panel use another control as their logical
        /// parent.
        /// </summary>
        /// <param name="logicalParent">
        /// The logical parent for the visual children of the panel.
        /// </param>
        /// <param name="children">
        /// The <see cref="ILogical.LogicalChildren"/> collection to modify.
        /// </param>
        void IReparentingControl.ReparentLogicalChildren(ILogical logicalParent, IPerspexList <ILogical> children)
        {
            Contract.Requires <ArgumentNullException>(logicalParent != null);
            Contract.Requires <ArgumentNullException>(children != null);

            _childLogicalParent = logicalParent;
            RedirectLogicalChildren(children);

            foreach (var control in Children)
            {
                ((ISetLogicalParent)control).SetParent(null);
                ((ISetLogicalParent)control).SetParent((IControl)logicalParent);
                children.Add(control);
            }
        }
예제 #3
0
        private static void UpdateLogicalChild(
            IPerspexList <ILogical> logicalChildren,
            object oldValue,
            object newValue)
        {
            if (oldValue != newValue)
            {
                var logical = oldValue as ILogical;

                if (logical != null)
                {
                    logicalChildren.Remove(logical);
                }

                logical = newValue as ILogical;

                if (logical != null)
                {
                    logicalChildren.Add(logical);
                }
            }
        }
예제 #4
0
        private static void UpdateLogicalChild(
            IControl control,
            IPerspexList <ILogical> logicalChildren,
            object oldValue,
            object newValue)
        {
            if (oldValue != newValue)
            {
                var child = oldValue as IControl;

                if (child != null)
                {
                    logicalChildren.Remove(child);
                }

                child = newValue as IControl;

                if (child != null)
                {
                    child.SetValue(Control.TemplatedParentProperty, control.TemplatedParent);
                    logicalChildren.Add(child);
                }
            }
        }
예제 #5
0
파일: Control.cs 프로젝트: Serg2DFX/Perspex
 /// <summary>
 /// Makes the control use a different control's logical children as its own.
 /// </summary>
 /// <param name="collection">The logical children to use.</param>
 protected void RedirectLogicalChildren(IPerspexList <ILogical> collection)
 {
     _logicalChildren = collection;
 }