Assembly: System.Windows.Forms (in system.windows.forms.dll)
'Declaration Public Property VirtualMode As Boolean 'Usage Dim instance As ListView Dim value As Boolean value = instance.VirtualMode instance.VirtualMode = value
/** @property */ public boolean get_VirtualMode () /** @property */ public void set_VirtualMode (boolean value)
public function get VirtualMode () : boolean public function set VirtualMode (value : boolean)
Property Valuetrue if ListView uses data-management operations that you provide; otherwise, false. The default is false.
Setting the VirtualMode property to true puts the ListView into virtual mode. In Virtual mode, the normal Items collection is unused. Instead, ListViewItem objects are created dynamically as the ListView requires them.
Virtual mode can be useful under many circumstances. If a ListView object must be populated from a very large collection already in memory, creating a ListViewItem object for each entry can be wasteful. In virtual mode, only the items required are created. In other cases, the values of the ListViewItem objects may need to be recalculated frequently, and doing this for the whole collection would produce unacceptable performance. In virtual mode, only the required items are calculated.
In order to use virtual mode, you must handle the RetrieveVirtualItem event, which is raised every time the ListView requires an item. This event handler should create the ListViewItem object that belongs at the specified index. In addition, the VirtualListSize property must be set to the size of the virtual list.
Handling the SearchForVirtualItem event enables searching in virtual mode. If this event is not handled, the FindItemWithText and FindNearestItem methods will return a null reference (Nothing in Visual Basic).
You can handle the CacheVirtualItems event in order to maintain a cache of ListViewItem objects. If the calculation or lookup to create a ListViewItem object is expensive, maintaining a cache can improve performance.
In virtual mode, the Items collection is disabled. Attempting to access it results in an InvalidOperationException. The same is true of the CheckedItems collection and the SelectedItems collection. If you want to retrieve the selected or checked items, use the SelectedIndices and CheckedIndices collections instead.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.