A
A
Artem Skopintsev2014-01-05 00:06:13
Microsoft Silverlight
Artem Skopintsev, 2014-01-05 00:06:13

How to implement listbox scrolling down using code?

Good day.
How to make it so that, for example, on clicking a button, the ListBox (WPF) scrolls to the very bottom?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Doshevsky, 2014-01-05
@SharperX

There are several options.
Simple - use the ListBox.ScrollIntoView method - it allows you to scroll the ListBox to a specific element. If you need more precise scrolling
, you need to get the ScrollViewer from the ListBox and work with it. For example, use the ScrollToBottom method. To get a ScrollViewer, you can use the GetFirstDescendantOfType method.

var scrollViewer = myListBox.GetFirstDescendantOfType<ScrollViewer>();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question