当前位置: 首页>>代码示例>>C#>>正文


C# FrameworkObject.ChangeLogicalParent方法代码示例

本文整理汇总了C#中MS.Internal.FrameworkObject.ChangeLogicalParent方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkObject.ChangeLogicalParent方法的具体用法?C# FrameworkObject.ChangeLogicalParent怎么用?C# FrameworkObject.ChangeLogicalParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MS.Internal.FrameworkObject的用法示例。


在下文中一共展示了FrameworkObject.ChangeLogicalParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveLogicalChild

 protected internal void RemoveLogicalChild(object child)
 {
     if (child == null)
     return;
       if (this.IsLogicalChildrenIterationInProgress)
     throw new InvalidOperationException(System.Windows.SR.Get("CannotModifyLogicalChildrenDuringTreeWalk"));
       FrameworkObject frameworkObject = new FrameworkObject(child as DependencyObject);
       if (frameworkObject.Parent == this)
     frameworkObject.ChangeLogicalParent((DependencyObject) null);
       IEnumerator logicalChildren = this.LogicalChildren;
       if (logicalChildren == null)
     this.HasLogicalChildren = false;
       else
     this.HasLogicalChildren = logicalChildren.MoveNext();
 }
开发者ID:jchristian,项目名称:ui_events,代码行数:15,代码来源:FrameworkElement.cs

示例2: RemoveLogicalChild

        // 





        protected internal void RemoveLogicalChild(object child)
        {
            if (child != null)
            {
                // It is invalid to modify the children collection that we
                // might be iterating during a property invalidation tree walk.
                if (IsLogicalChildrenIterationInProgress)
                {
                    throw new InvalidOperationException(SR.Get(SRID.CannotModifyLogicalChildrenDuringTreeWalk));
                }

                // Child is present
                FrameworkObject fo = new FrameworkObject(child as DependencyObject);
                if (fo.Parent == this)
                {
                    fo.ChangeLogicalParent(null);
                }

                // This could have been the last child, so check if we have any more children
                IEnumerator children = LogicalChildren;

                // if null, there are no children.
                if (children == null)
                {
                    HasLogicalChildren = false;
                }
                else
                {
                    // If we can move next, there is at least one child
                    HasLogicalChildren = children.MoveNext();
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:39,代码来源:FrameworkContentElement.cs

示例3: OnCoerceContent

        /// <summary>
        ///     Coerces the Content property.  We're choosing a value between Column.Header and the Content property on ColumnHeader.
        /// </summary>
        private static object OnCoerceContent(DependencyObject d, object baseValue)
        {
            var header = d as DataGridColumnHeader;

            object content = DataGridHelper.GetCoercedTransferPropertyValue(
                header,
                baseValue,
                ContentProperty,
                header.Column,
                DataGridColumn.HeaderProperty);

            // if content is a WPF element with a logical parent, disconnect it now
            // so that it can be connected to the DGColumnHeader.   This happens during
            // a theme change - see Dev11 146729.
            FrameworkObject fo = new FrameworkObject(content as DependencyObject);
            if (fo.Parent != null && fo.Parent != header)
            {
                fo.ChangeLogicalParent(null);
            }

            return content;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:25,代码来源:DataGridColumnHeader.cs

示例4: AddLogicalChild

        // 





        protected internal void AddLogicalChild(object child)
        {
            if (child != null)
            {
                // It is invalid to modify the children collection that we
                // might be iterating during a property invalidation tree walk.
                if (IsLogicalChildrenIterationInProgress)
                {
                    throw new InvalidOperationException(SR.Get(SRID.CannotModifyLogicalChildrenDuringTreeWalk));
                }

                // Now that the child is going to be added, the FE/FCE construction is considered finished,
                // so we do not expect a change of InheritanceBehavior property,
                // so we can pick up properties from styles and resources.
                TryFireInitialized();

                bool exceptionThrown = true;
                try
                {
                    HasLogicalChildren = true;

                    // Child is present; reparent him to this element
                    FrameworkObject fo = new FrameworkObject(child as DependencyObject);
                    fo.ChangeLogicalParent(this);

                    exceptionThrown = false;
                }
                finally
                {
                    if (exceptionThrown)
                    {
                        // 


                        // Consider doing this...
                        //RemoveLogicalChild(child);
                    }
                }
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:46,代码来源:FrameworkContentElement.cs


注:本文中的MS.Internal.FrameworkObject.ChangeLogicalParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。