orelzion
orelzion

Reputation: 2532

Auto scroll listbox wp7

I have a listbox of many richtextboxex in it. Now I want to enable an auto scrolling feature for it. I can't just do listBox.SelectedIndex++;in a timer or somthing, because then it will just go to the other richtextbox and I don't want that. I'd like somthing more like this

sv.ScrollToVerticalOffset(sv.VerticalOffset + 5);

which works perfectly in scroll view, can I implement the same thing to a listbox?

Upvotes: 1

Views: 1003

Answers (3)

orelzion
orelzion

Reputation: 2532

Well I found what I was looking for

            ScrollViewer sv = ((VisualTreeHelper.GetChild(listBox, 0) as FrameworkElement).FindName("ScrollViewer") as ScrollViewer);
        sv.ScrollToVerticalOffset(sv.VerticalOffset + 0.004);

Thank you guys

Upvotes: 2

Matt Lacey
Matt Lacey

Reputation: 65564

If you use something like Linq To Visual Tree you can get at the ScrollViewer inside the ListBox and then call ScrollToVerticalOffset on that.

Upvotes: 1

SENTHIL KUMAR
SENTHIL KUMAR

Reputation: 647

Yes you can. Here you should give the item index it automatically scrolls to the item

 list.ScrollIntoView(object item);

Upvotes: 0

Related Questions