I'm just struggling with issue how to automate selecting some rows, nodes on WPF list view and WPF tree view in the other way than just passing an index to ClickItem or Select method.
Our WPF list views and three views controls use virtualization - they are dynamically fed by data from database and thus in the exact moment those controls contain only a sort of all data.
Index is not a good solution because it may change in time when any new data arrives to DB and to the list/tree views. Is there any way to use ClickItem method with passing name of row, node to it despite only some sub set of data is currently loaded to the control?
Needs to add that Count property in those controls shows the whole number of objects in DB e.g. 4000000 (for scrolling purpose assuming) but the data current control contains is e.g. only 100 rows (visible ones).
See how WPF virtualization works on google for clarification.
Regarding to list views I move the VScroll position like this:
if(idx%30 == 0) ListViewRef.VScroll.Pos += 30; (this save would be for tree view).
This is much more faster than just moving the list by one position down. But it seems it is not still fast enough if you have thousands of elements either on tree view or list view thought.
If items are delay loaded, you can probably consider using the control's native methods to find a specific item. I guess there should be some native method or property which allows finding/selecting an item in the control regardless of whether the item is visible (and loaded). This will probably be more reliable and effective than simulating user actions over the control.