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


C# UIElement.GetUIParentWithinLayoutIsland方法代码示例

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


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

示例1: Add

            internal void Add(UIElement e)
            { 
                if(getRequest(e) != null) return; 
                if(e.CheckFlagsAnd(VisualFlags.IsLayoutSuspended)) return;
 
                RemoveOrphans(e);

                UIElement parent = e.GetUIParentWithinLayoutIsland();
                if(parent != null && canRelyOnParentRecalc(parent)) return; 

                ContextLayoutManager layoutManager = ContextLayoutManager.From(e.Dispatcher); 
 
                if(layoutManager._isDead) return;
 
                //10 is arbitrary number here, simply indicates the queue is
                //about to be filled. If not queue is not almost full, simply add
                //the element to it. If it is almost full, start conserve entries
                //by escalating invalidation to all the ancestors until the top of 
                //the visual tree, and only add root of visula tree to the queue.
                if(_pocketSize > PocketReserve) 
                { 
                    _addRequest(e);
                } 
                else
                {
                    //walk up until we are the topmost UIElement in the tree.
                    //on each step, mark the parent dirty and remove it from the queues 
                    //only leave a single node in the queue - the root of visual tree
                    while(e != null) 
                    { 
                        UIElement p = e.GetUIParentWithinLayoutIsland();
 
                        invalidate(e); //invalidate in any case

                        if (p != null) //not yet a root
                        { 
                            Remove(e);
                        } 
                        else //root of visual tree 
                        {
                            if (getRequest(e) == null) 
                            {
                                RemoveOrphans(e);
                                _addRequest(e);
                            } 
                        }
                        e = p; 
                    } 
                }
 
                layoutManager.NeedsRecalc();
            }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:52,代码来源:LayoutManager.cs


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