novabankaee
asked on
Focus to an Item in ListView C# 3.5 Compact
Hello,
I have a ListView control and I fill a ListView through SortedList. I need, when I put word or part of a word in text box and click Search button to find word in sorted list, get it's index and to jump to specific row (Item) in ListView with searched index. In compact framework I don't have TopItem properties so I need another way to scroll to specific row in ListView.
I also need that searched row would be on top row in ListView or at least in second or third row.
Thanks
I have a ListView control and I fill a ListView through SortedList. I need, when I put word or part of a word in text box and click Search button to find word in sorted list, get it's index and to jump to specific row (Item) in ListView with searched index. In compact framework I don't have TopItem properties so I need another way to scroll to specific row in ListView.
I also need that searched row would be on top row in ListView or at least in second or third row.
Thanks
//sl-SortedList; myListView_SelectedIndexChanget event
txtValue.Text = sl.GetByIndex(myListView.SelectedIndices[0].ToString())
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As I said, the EnsureVisible method is as good as you are going to get.
Although, you could try making the last item visible, then calling the EnsureVisible method to get your selected item visible. This should make it display near the top of the ListView.
Although, you could try making the last item visible, then calling the EnsureVisible method to get your selected item visible. This should make it display near the top of the ListView.
ASKER
I use EnsureVisible twice.
First myListView.EnsureVisible(m axindex - 1) as you said and second with searched index I get Item on the Top.
Thanks a lot Wayne
First myListView.EnsureVisible(m
Thanks a lot Wayne
ASKER
Thansk a lot Wayne
ASKER
I need that row to be on top of the ListView but I get Item at the bottom of the ListView.
I get selected row grayed with:
myListView.Item[myindex].S