本文整理汇总了C#中ElementCollection.RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C# ElementCollection.RemoveAt方法的具体用法?C# ElementCollection.RemoveAt怎么用?C# ElementCollection.RemoveAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElementCollection
的用法示例。
在下文中一共展示了ElementCollection.RemoveAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EliminateUselessGroupNesting
private static void EliminateUselessGroupNesting(ElementCollection elements)
{
for (var i = 0; i < elements.Count; i++)
{
var group = elements[i] as Group;
if (group == null)
{
continue;
}
EliminateUselessGroupNesting(group.Children);
if (IsUselessGroup(group))
{
elements.RemoveAt(i);
var count = group.Children.Count;
while (group.Children.Count > 0)
{
elements.MoveTo(i, group.Children[group.Children.Count - 1]);
}
i += count - 1;
}
}
}
示例2: RaisesCollectionChangedEvent
public void RaisesCollectionChangedEvent()
{
var collection = new ElementCollection<Axis>(new PlotModel());
var axis = new LinearAxis();
collection.Add(axis);
ElementCollectionChangedEventArgs<Axis> eventArgs = null;
var raisedCount = 0;
collection.CollectionChanged += (sender, e) =>
{
eventArgs = e;
raisedCount++;
};
collection.RemoveAt(0);
Assert.AreEqual(1, raisedCount);
Assert.AreEqual(1, eventArgs.RemovedItems.Count);
Assert.IsTrue(ReferenceEquals(axis, eventArgs.RemovedItems[0]));
}
示例3: RemoveEmptyGroups
private static void RemoveEmptyGroups(ElementCollection elements)
{
for (var i = 0; i < elements.Count; i++)
{
var element = elements[i] as ElementWithChildren;
if (element == null)
{
continue;
}
RemoveEmptyGroups(element.Children);
if (element.Children.All(x => x is ClipPath))
{
elements.RemoveAt(i--);
}
}
}
示例4: RemoveInvisiblePaths
private static void RemoveInvisiblePaths(ElementCollection elements)
{
for (var i = 0; i < elements.Count; i++)
{
var element = elements[i];
if (element is Path)
{
if (!IsPathVisible((Path)element))
{
elements.RemoveAt(i--);
}
continue;
}
if (element is ClipPath)
{
if (string.IsNullOrEmpty(((ClipPath)element).PathData))
{
elements.RemoveAt(i--);
}
continue;
}
if (element is ElementWithChildren)
{
RemoveInvisiblePaths(((ElementWithChildren)element).Children);
}
}
}