1

I have a ListView in VirtualMode.

I need a way to set focus to specific item.

The FocusedItem is not good for the VirtualMode, I need a way to set FocusedIndex or something like that, but didn't see any property like that.

Thanks.

DxCK
  • 4,402
  • 7
  • 50
  • 89

2 Answers2

4

You have to set the Focused property on the ListViewItem directly.

So, to set the 11th row to be focused:

this.lvVirtual.Items[10].Focused = true;
Grammarian
  • 6,774
  • 1
  • 18
  • 32
  • I once tried to change the icon of a virtual item this way without success, and then stopped use `.Items` to access virtual items. Thanks for the example, worked for me! :) – DxCK Jan 14 '11 at 10:39
1

As it has been said ListView is in VirtualMode. Items collection is not accessible here.

Try to raise an event VirtualItemsSelectionRangeChanged

Alex
  • 11
  • 1