this.DropDownListBox.SelectedIndex = index;
this.DropDownListBox.UpdateLayout();
this.DropDownListBox.ScrollIntoView(this.DropDownListBox.SelectedItem);
Tuesday, September 9, 2008
Silverlight Tip 3#: ScrollIntoView
When you programmatically set selected item in a ListBox control and the item is unvisible, the Listbox doesn't automatically scroll to make it visible. But you can use ScrollIntoView method.
Labels:
Silverlight
Subscribe to:
Post Comments (Atom)
4 comments:
Thanks. I was stucked in this issue :)
ScrollIntoView doesn't work for me...
I had a problem with ScrollIntoView not working properly in scrollbar-less ListBox, turns out I had ScrollViewer.VerticalScrollBarVisibility set to "Disabled".
After switching to "Hidden", it worked.
Adding a call to UpdateLayout on the list is what fixed it for me. Thanks!
Post a Comment