本文整理汇总了C#中ItemInfo.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# ItemInfo.Clone方法的具体用法?C# ItemInfo.Clone怎么用?C# ItemInfo.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemInfo
的用法示例。
在下文中一共展示了ItemInfo.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateSelectedItems
/// <summary>
/// Adds or Removes from SelectedItems when deferred selection is not handled by the caller.
/// </summary>
private void UpdateSelectedItems(ItemInfo info, bool add)
{
bool updatingSelectedItems = IsUpdatingSelectedItems;
if (!updatingSelectedItems)
{
BeginUpdateSelectedItems();
}
try
{
if (add)
{
SelectedItemCollection.Add(info.Clone());
}
else
{
SelectedItemCollection.Remove(info);
}
}
finally
{
if (!updatingSelectedItems)
{
EndUpdateSelectedItems();
}
}
}
示例2: MakeFullRowSelection
//.........这里部分代码省略.........
{
ItemInfo itemInfo = _selectedItems[index];
int itemIndex = itemInfo.Index;
if ((removeRangeStartIndex <= itemIndex) && (itemIndex <= removeRangeEndIndex))
{
// Selector has been signaled to delay updating the
// collection until we have finished the entire update.
// The item will actually remain in the collection
// until EndUpdateSelectedItems.
SelectionChange.Unselect(itemInfo);
}
}
_selectedCells.RemoveRegion(removeRangeStartIndex, 0, removeRangeEndIndex - removeRangeStartIndex + 1, Columns.Count);
}
}
// Select the children in the selection range
IEnumerator enumerator = ((IEnumerable)Items).GetEnumerator();
for (int index = 0; index <= endIndex; index++)
{
if (!enumerator.MoveNext())
{
// In case the enumerator ends unexpectedly
break;
}
if (index >= startIndex)
{
SelectionChange.Select(ItemInfoFromIndex(index), true);
}
}
IDisposable d = enumerator as IDisposable;
if (d != null)
{
d.Dispose();
}
_selectedCells.AddRegion(startIndex, 0, endIndex - startIndex + 1, _columns.Count);
}
}
}
else
{
if (minimalModify && _selectedItems.Contains(info))
{
// Unselect the one item
UnselectItem(info);
}
else
{
if (!minimalModify || !CanSelectMultipleItems)
{
// Unselect the other items
if (_selectedCells.Count > 0)
{
// Pre-emptively clear the SelectedCells collection, which is O(1),
// instead of waiting for the selection change notification to clear
// SelectedCells row by row, which is O(n).
_selectedCells.Clear();
}
if (SelectedItems.Count > 0)
{
SelectedItems.Clear();
}
}
if (_editingRowInfo == info)
{
// ADO.Net bug workaround, see remarks.
int numColumns = _columns.Count;
if (numColumns > 0)
{
_selectedCells.AddRegion(_editingRowInfo.Index, 0, 1, numColumns);
}
SelectItem(info, false);
}
else
{
// Select the item
SelectItem(info);
}
}
_selectionAnchor = new DataGridCellInfo(info.Clone(), ColumnFromDisplayIndex(0), this);
}
}
finally
{
if (!alreadyUpdating)
{
EndUpdateSelectedItems();
}
}
}
}