【发布时间】:2015-02-08 04:34:10
【问题描述】:
public new int VirtualListSize
{
get { return base.VirtualListSize; }
set
{
// If the new size is smaller than the Index of TopItem, we need to make
// sure the new TopItem is set to something smaller.
if (VirtualMode &&
View == View.Details &&
TopItem != null &&
value > 0 &&
TopItem.Index > value - 1)
{
TopItem = Items[value - 1];
}
base.VirtualListSize = value;
}
}
我正在尝试设置 listview 的 topitem 属性,但是在虚拟模式下,项目被禁用。所以任何试图在虚拟模式下访问它的代码都会抛出一个无效操作异常。当我尝试逐行调试时不会发生异常。如果我评论 TopItem=Items[value-1] 行,它不会引发任何异常。
System.InvalidOperationException:在 VirtualMode 中,ListView RetrieveVirtualListItem 事件需要每个 ListView 列的列表视图 SubItem。 在 System.Windows.Forms.ListView.WmReflectNotify(消息和 m) 在 System.Windows.Forms.ListView.WndProc(消息和 m) 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam) 请建议。
【问题讨论】:
标签: listview c#-3.0 listviewitem virtualmode