always one item is selected/highlighted in treeview and listview c# winform -
in mdi child form,
how can force 1 item selected/highlighted.
when load form, want see first node of treeview highlighted, if navigate away ie use other child forms, should 1 item highlighted.
also, same approach need done on listview
thank you
while setting hideselection
property necessary highlight selected items when control not focused, not enough. situations when item (node) focused not selected valid , can achieved user (and item focused not selected marked when control active).
however can use simple trick force focused item selected (and visible when control not active):
private void listview_itemselectionchanged(object sender, listviewitemselectionchangedeventargs e) { if (e.item.focused) e.item.selected = true; }
also not forget focus first item (node) of control after populating it, 1 item (node) highlighted.
Comments
Post a Comment