本文整理汇总了C#中System.Windows.Media.Visual.FireOnVisualParentChanged方法的典型用法代码示例。如果您正苦于以下问题:C# Visual.FireOnVisualParentChanged方法的具体用法?C# Visual.FireOnVisualParentChanged怎么用?C# Visual.FireOnVisualParentChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Visual
的用法示例。
在下文中一共展示了Visual.FireOnVisualParentChanged方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveVisualChild
/// <summary>
/// DisconnectChild
///
/// Derived classes must call this method to notify the Visual layer that a
/// child was removed from the children collection. The Visual layer will then call
/// GetChildren to find out which child has been removed.
///
/// </summary>
protected void RemoveVisualChild(Visual child)
{
if (child == null || child._parent == null)
{
return;
}
if (child._parent != this)
{
throw new ArgumentException(SR.Get(SRID.Visual_NotChild));
}
if(InternalVisual2DOr3DChildrenCount == 0)
{
SetFlags(false, VisualFlags.HasChildren);
}
//
// Remove the child on all channels its current parent is marshalled to.
//
for (int i = 0; i < _proxy.Count; i++)
{
DUCE.Channel channel = _proxy.GetChannel(i);
if (child.CheckFlagsAnd(channel, VisualProxyFlags.IsConnectedToParent))
{
child.SetFlags(channel, false, VisualProxyFlags.IsConnectedToParent);
DUCE.IResource childResource = (DUCE.IResource)child;
childResource.RemoveChildFromParent(this, channel);
childResource.ReleaseOnChannel(channel);
}
}
// Set the parent pointer to null.
child._parent = null;
Visual.PropagateFlags(
this,
VisualFlags.IsSubtreeDirtyForPrecompute,
VisualProxyFlags.IsSubtreeDirtyForRender);
UIElement.PropagateSuspendLayout(child);
// Fire notifications
child.FireOnVisualParentChanged(this);
OnVisualChildrenChanged(null /* no child added */, child);
}
示例2: RemoveVisualChild
/// <summary>
/// DisconnectChild
///
/// This method is called to remove the 2D visual child of the Viewport2DVisual3D
///
/// </summary>
private void RemoveVisualChild(Visual child)
{
if (child == null || child._parent == null)
{
return;
}
if (child._parent != this)
{
throw new ArgumentException(SR.Get(SRID.Visual_NotChild));
}
// NOTE: We'll let the VisualBrush handle final cleanup from the channel
//
child._parent = null;
// NOTE: We also let the VisualBrush handle any flag propagation issues (so Visual(3D).RemoveVisualChild for
// the things they propagate) as well as layout.
// Fire notifications
child.FireOnVisualParentChanged(this);
OnVisualChildrenChanged(null /* no child added */, child);
}
示例3: AddVisualChild
/// <summary>
/// AttachChild
///
/// Derived classes must call this method to notify the Visual layer that a new
/// child appeard in the children collection. The Visual layer will then call the GetVisualChild
/// method to find out where the child was added.
///
/// Remark: To move a Visual child in a collection it must be first disconnected and then connected
/// again. (Moving forward we might want to add a special optimization there so that we do not
/// unmarshal our composition resources).
///
/// It is okay to type this protected API to the 2D Visual. The only 2D Visual with
/// 3D childern is the Viewport3DVisual which is sealed. -- [....] 01/17/06
/// </summary>
protected void AddVisualChild(Visual child)
{
if (child == null)
{
return;
}
if (child._parent != null)
{
throw new ArgumentException(SR.Get(SRID.Visual_HasParent));
}
SetFlags(true, VisualFlags.HasChildren);
// Set the parent pointer.
child._parent = this;
//
// The child might be dirty. Hence we need to propagate dirty information
// from the parent and from the child.
//
Visual.PropagateFlags(
this,
VisualFlags.IsSubtreeDirtyForPrecompute,
VisualProxyFlags.IsSubtreeDirtyForRender);
Visual.PropagateFlags(
child,
VisualFlags.IsSubtreeDirtyForPrecompute,
VisualProxyFlags.IsSubtreeDirtyForRender);
//
// Resume layout.
//
UIElement.PropagateResumeLayout(this, child);
// Fire notifications
this.OnVisualChildrenChanged(child, null /* no removed child */);
child.FireOnVisualParentChanged(null);
}
示例4: AddVisualChild
/// <summary>
/// AttachChild
///
/// This method is called to add a 2D Visual child to the Viewport2DVisual3D
///
/// </summary>
private void AddVisualChild(Visual child)
{
if (child == null)
{
return;
}
if (child._parent != null)
{
throw new ArgumentException(SR.Get(SRID.Visual_HasParent));
}
// Set the parent pointer.
child._parent = this;
// NOTE: Since the 2D object is on a VisualBrush, it will allow it to handle
// the dirtyness of the 2D object, realization information, as well as layout. See
// Visual(3D).AddVisualChild for the things they propagate on adding a new child
// Fire notifications
this.OnVisualChildrenChanged(child, null /* no removed child */);
child.FireOnVisualParentChanged(null);
}