WPF ListBox controls horizontal scrolling of code

How can I set the horizontal scroll position of a list box in code? I have a window with a skin pane in an item template and I want to implement a "page right" feature that behaves like a page down in a normal list, but works sideways.

Thank!

+2


source to share


2 answers


With a few more searches around the site, I figured out the answer to my question.

Using the following function from Josh G answer this question

public static childItem FindVisualChild<childItem>(DependencyObject obj)
{
     ...
}  

      



With this function per page left and right via code, all you have to do is the following (where listBox is the name of my ListBox control),

void PageRight()
{
    ScrollViewer myScrollviewer = FindVisualChild<ScrollViewer>(listBox);
    myScrollviewer.PageRight();
}

      

+2


source


You can use method ScrollIntoView

to scroll specific element as



0


source







All Articles