Question

I want to scroll into selected item in a list box .for that now I am using one line of code in Listbox1_SelectionChanged event, but scroll is not working. I tried the same in a button click that is working fine .

Listbox1.ScrollIntoView(Listbox1.Items[Listbox1.SelectedIndex]);
Était-ce utile?

La solution

I used in my solution first updated UI and the called ScrollIntoView it works fine:

follow this link for more info

Listbox1.UpdateLayout();
Listbox1.ScrollIntoView(Listbox1.Items[Listbox1.SelectedIndex]);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top