I am writing listView1.Items[1].Selected = true;
but it does not highlight that item….what is wrong?
I also changed the HideSelection property to False, so now at least I can see some Gray highlight color, but where is the blue color? when I click with Mouse, it is blue, but when I set it with code as posted above , it is not blue… what am I doing wrong?
I am writing listView1.Items[1].Selected = true; but it does not highlight that item….what is
Share
It’s your Windows colors that are tricking you.
I just tested it, and with
HideSelectionset to false, I set the selected item, and I see that item turn grey, which is my Windows color definition for a selected item in an inactive control.If you want it to turn blue, which is most likely the color of a selected item in an active control, set the focus to that
ListView, sayinglistView1.Focus(), and you’ll see that color you’re talking about, but you’ve just changed the focus to it, so be careful.