本文整理汇总了C#中ItemCollection.SetItemIndexes方法的典型用法代码示例。如果您正苦于以下问题:C# ItemCollection.SetItemIndexes方法的具体用法?C# ItemCollection.SetItemIndexes怎么用?C# ItemCollection.SetItemIndexes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemCollection
的用法示例。
在下文中一共展示了ItemCollection.SetItemIndexes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetPreparedItems
/// <summary>
/// Called after the collection of items to be displayed has been set up.
/// </summary>
/// <param name="setItems">If set to <c>true</c>, the <see cref="Items"/> will be set to the given <paramref name="preparedItems"/>,
/// else, the <see cref="Items"/> will be left unchanged.</param>
/// <param name="preparedItems">Elements to be put into the <see cref="Items"/> collection.</param>
/// <param name="setChildren">If set to <c>true</c>, the children of our host panel will be set to the given
/// <paramref name="preparedChildren"/>, else, they will be left unchanged.</param>
/// <param name="preparedChildren">Elements to be put into the <see cref="Panel.Children"/> of our host panel.</param>
protected void SetPreparedItems(bool setItems, ItemCollection preparedItems, bool setChildren, ItemCollection preparedChildren)
{
ItemCollection oldPreparedItems;
ItemCollection oldPreparedChildren;
lock (_renderLock)
{
oldPreparedItems = _preparedItems;
oldPreparedChildren = _preparedChildren;
_preparedItems = preparedItems;
_preparedChildren = preparedChildren;
if (_preparedItems != null)
_preparedItems.SetItemIndexes();
if (_preparedChildren != null)
_preparedChildren.SetItemIndexes();
_setItems = setItems;
_setChildren = setChildren;
}
// If one of those oldXXX properties is set, this method was called multiple times before _preparedItems could be
// used by UpdatePreparedItems, so dispose old items
if (oldPreparedItems != null)
oldPreparedItems.Dispose();
if (oldPreparedChildren != null)
oldPreparedChildren.Dispose();
if (_elementState == ElementState.Preparing)
// Shortcut in state Preparing - no render thread necessary here to do the UpdatePreparedItems work
UpdatePreparedItems();
InvalidateLayout(true, true);
}