Menu

#1 Update of Clone in ContainerListViewItem

open
nobody
None
5
2008-01-03
2008-01-03
Jon Bullen
No

I have hit some issues where the SubItem collection is empty. If you move from using the Index directly to Insert it works.

/// <summary>
/// Creates a copy of this <see cref="ContainerListViewItem"/> that is not attached to a list.
/// </summary>
/// <returns></returns>
public object Clone()
{
ContainerListViewItem lvi = new ContainerListViewItem();

lvi._backColor = _backColor;
lvi._font = _font;
lvi._foreColor = _foreColor;
lvi._imageIndex = _imageIndex;
lvi._selectedImageIndex = _selectedImageIndex;
lvi._listView = _listView;
lvi._tag = _tag;

for(int index = 0; index < _subItems.Count; ++index)
lvi._subItems.Insert(index,_subItems[index].Clone());

return lvi;
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.