Hi I just tried to select an item in alistview by code. But there is no SelectedIndex property, and also the property SelectedIndices does not provide a possibility. How do I do that?
The ListView doesn’t have the SelectedIndex property (we should probably add it – it’s not in WinForms either) and the SelectedIndices and SelectedItems are read-only collections by design.
To select an item programmatically use the Selected property of the item: this.listView.Items.Selected = true. Look also at the SelectionMode and MultiSelect properties on the ListView. https://wisej.com/docs/html/Properties_T_Wisej_Web_ListView.htm
See https://msdn.microsoft.com/en-us/library/y4x56c0b(v=vs.110).aspx (you don need to set .Focused = true, use only .Selected = true)
I just installed Version 1.3.5. When I set the selection by listView.Items[xx].Selected, on the selected item the background color is now properly set, but the orange border stays at the item recently selected by mouse click
But setting listView.Items[xx].Selected = true does not properly get to work. Wenn I set listView.Items[xx].Selected = true, the value is set, SelectedItems is also properly updated, but the selection mark is never set. Please see the test application attached