how to keep an item focused in c# listview?
i'm trying to keep the last pressed item hi开发者_开发技巧ghlighted in the listview, anyone know how can i do it?
I'm assuming you want to keep the selected item highlighted when the control loses focus.
Then you should check out the HideSelection property.
You can subscribe to the SelectedIndexChanged
event and change the selected index/item to the last one.
Looks like you can use ListView::DrawItem for that. Have a look here for an example.
Try looking at the code example here: List view Highlight selected. It shows how to set the foreground/background color of the listview selected item when you change focus away from the listview control.
精彩评论