locked
Binding the Scrollbars of two controls, and Treeview and a ScrollViewer RRS feed

  • Question

  • I need to bind the Vertical Scrollbars of a TreeView and a ScrollViewer. Any ideas of where to start? I want the scollviewer to have a different Horizontal scrollbar than the treeview but I want both to vertically scroll together.

    Thanks, Bubba

    Wednesday, September 8, 2010 8:31 PM

Answers

  • Yes, I was planning on hiding the TreeViews Vertical scrollbar. What I did was create a style and assigned an event to the treeviews scroll and to the scrollviewers scroll events. I set each's verticaloffset to the others depending on which one was called. It works. Although the TreeView controls the ScrollViewer and I wanted the vice versa. Also if I run the mouse wheel over the scroll viewer it scrolls and the tree does not.

    Thanks!

    • Marked as answer by BubbaRichard Friday, September 10, 2010 9:52 PM
    Friday, September 10, 2010 9:52 PM

All replies

  • Should one control the other? Both control each other? Is this WPF or Silverlight?

    This is going to be a bit tricky as the scrollbars are inside the templates. Not impossible, just need more details to post a useful answer.

    Thursday, September 9, 2010 1:40 PM
    Moderator
  • Yes, I was planning on hiding the TreeViews Vertical scrollbar. What I did was create a style and assigned an event to the treeviews scroll and to the scrollviewers scroll events. I set each's verticaloffset to the others depending on which one was called. It works. Although the TreeView controls the ScrollViewer and I wanted the vice versa. Also if I run the mouse wheel over the scroll viewer it scrolls and the tree does not.

    Thanks!

    • Marked as answer by BubbaRichard Friday, September 10, 2010 9:52 PM
    Friday, September 10, 2010 9:52 PM