本文整理汇总了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();
}