本文整理汇总了C#中Connector.ClearChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Connector.ClearChildren方法的具体用法?C# Connector.ClearChildren怎么用?C# Connector.ClearChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connector
的用法示例。
在下文中一共展示了Connector.ClearChildren方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExpandNode
/// <summary>
/// Exapnds and collapses the referenced node.
/// </summary>
/// <param name="nvdrb">The view data for this node.</param>
public void ExpandNode(NodeViewDataReferencedBehavior nvdrb)
{
// if the referenced behaviours was not yet loaded, try so
if(_referencedBehavior ==null)
{
LoadReferencedBehavior();
// if we could not load it, skip
if(_referencedBehavior ==null)
return;
}
// this code can be called without a change of IsExpanded so you cannot assume that the current children were from the other state
if(nvdrb.IsExpanded)
{
// clear the generated sub-reference graph
_genericChildrenLocal.ClearChildren();
// remove any remaining subitems because of minimum count
for(int i= 0; i <_subItems.Count; ++i)
{
SubItemConnector subconn= _subItems[i] as SubItemConnector;
if(subconn !=null && subconn.Connector ==_genericChildren)
{
RemoveSubItem(subconn);
--i;
}
}
// assign the connector of the behaviour
_genericChildren= _referencedBehavior.GenericChildren;
_children.SetConnector(_genericChildren);
// add all the subitems needed
int count= Math.Max(_genericChildren.ChildCount, _genericChildren.MinCount);
for(int i= 0; i <count; ++i)
{
Node child= i <_genericChildren.ChildCount ? _genericChildren.GetChild(i) : null;
AddSubItem(new SubItemConnector(_genericChildren, child, i));
}
}
else
{
// remove all subitems of the behaviour
for(int i= 0; i <_subItems.Count; ++i)
{
SubItemConnector subconn= _subItems[i] as SubItemConnector;
if(subconn !=null && subconn.Connector ==_genericChildren)
{
RemoveSubItem(subconn);
--i;
}
}
// assign the connector for the sub-reference graph
_genericChildren= _genericChildrenLocal;
_children.SetConnector(_genericChildren);
// make the connector writable to edit it
_genericChildren.IsReadOnly= false;
// add all the subitems needed
int count= Math.Max(_genericChildren.ChildCount, _genericChildren.MinCount);
for(int i= 0; i <count; ++i)
{
Node child= i <_genericChildren.ChildCount ? _genericChildren.GetChild(i) : null;
AddSubItem(new SubItemConnector(_genericChildren, child, i));
}
// clear the generated sub-reference graph
_genericChildren.ClearChildren();
// generate the dummy nodes for the sub-referenced behaviours
foreach(Node child in ((Node)_referencedBehavior).Children)
GenerateReferencedBehaviorsTree(nvdrb.RootBehavior, this, child);
// make the connector read-only so the user cannot modify it
_genericChildren.IsReadOnly= true;
}
}