本文整理汇总了C#中System.Windows.Media.Visual.SetFlagsOnAllChannels方法的典型用法代码示例。如果您正苦于以下问题:C# Visual.SetFlagsOnAllChannels方法的具体用法?C# Visual.SetFlagsOnAllChannels怎么用?C# Visual.SetFlagsOnAllChannels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Visual
的用法示例。
在下文中一共展示了Visual.SetFlagsOnAllChannels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PropagateFlags
/// <summary>
/// Propagates the flags up to the root.
/// </summary>
/// <remarks>
/// The walk stops on a node with all of the required flags set.
/// </remarks>
internal static void PropagateFlags(
Visual e,
VisualFlags flags,
VisualProxyFlags proxyFlags)
{
while ((e != null) &&
(!e.CheckFlagsAnd(flags) || !e.CheckFlagsOnAllChannels(proxyFlags)))
{
if (e.CheckFlagsOr(VisualFlags.ShouldPostRender))
{
MediaContext mctx = MediaContext.From(e.Dispatcher);
if (mctx.Channel != null)
{
mctx.PostRender();
}
}
else if (e.CheckFlagsAnd(VisualFlags.NodeIsCyclicBrushRoot))
{
//
// For visuals that are root nodes in visual brushes we
// need to fire OnChanged on the owning brushes.
//
Dictionary<ICyclicBrush, int> cyclicBrushToChannelsMap =
CyclicBrushToChannelsMapField.GetValue(e);
Debug.Assert(cyclicBrushToChannelsMap != null, "Visual brush roots need to have the visual brush to channels map!");
//
// Iterate over the visual brushes and fire the OnChanged event.
//
foreach (ICyclicBrush cyclicBrush in cyclicBrushToChannelsMap.Keys)
{
cyclicBrush.FireOnChanged();
}
}
e.SetFlags(true, flags);
e.SetFlagsOnAllChannels(true, proxyFlags);
if (e._parent == null)
{
// Stop propagating. We are at the root of the 2D subtree.
return;
}
Visual parentAsVisual = e._parent as Visual;
if (parentAsVisual == null)
{
// if the parent is not null (saw this with earlier null check) and is not a Visual
// it must be a Visual3D - continue the propagation
Visual3D.PropagateFlags((Visual3D)e._parent, flags, proxyFlags);
return;
}
e = parentAsVisual;
}
}