I have used this awesome control in a very basic list for years just to show a list of items. I chose this control because I knew it had great features that would cover anything more I would want to do with it.
BUT WAIT, how about a very simple find feature that focuses the results at the top of the list?
I want to implement a find/search function. Just type the search text into a textbox and the ObjectListView could have the function to find the row, highlight it, and MOST importantly scroll so that the first matching row is scrolled to the top of the list.
Seems like everyone would want this yet I cannot find any instructions on how to do this through all the examples and support and cookbook and websites devoted to this control. This leads me to believe the control does not support this simple feature?
Maybe I am still missing something? If so please point me in the right direction. Again I love the control and hope it can support this basic feature.
You are right. Out of the box, ObjectListView does not provide this feature.
Mostly this is because I've never needed it -- I also use the text filtering feature[^]. This does what you are asking very nicely.
A lesser reason is that moving an item to the top of a ListView is actually tricky and error prone. If you have a look at the code in ObjectListView.TopItemIndex, you can see the lengths I go to try and make it work. A bigger limitation is that it will only work in Details view and will never work when showing groups (MS's limitations, not mine).
If you are willing to only search on the primary column's contents AND you are in details view AND you are not showing groups, you can do this: