문제

I am using a listView on virtual mode, and on SearchForVirtualItem event I would like to mark the found item, the same way that clicking on this item would highlight it (a blue back color).

I have tried: listView.Items[foundItem.Index].Selected = true;

but it does not highlight it the same way (a light gray back color). what should I do?

도움이 되었습니까?

해결책

You need to call .Select

listView.Items[foundItem.Index].Selected = true;
listView.Select();

다른 팁

While you're setting the selection (which gives the blue colour), I believe the grey outline comes from the focus. You can get around this by adding this line below your current one:

listView.Items[foundItem.Index].Focused = true;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top