In WPF, I have a scrollviewer with 7 different group boxes. Each group box is a separate separate section for different forms. Since the scrollviewer is so long, I put a series of buttons on the stack of the panel to the left of the panel and executed the code, so pressing the button calls the BringIntoView method for the corresponding group field.
My question is, is there a way to get BringIntoView to place a group box at the top of the visible section every time. By default, BringIntoView only moves the scrollviewer until the entire group box is in view, and not so that the topmost item is displayed. Is there any way around this?
I looked through using ScrollToVerticalOffset, but could not figure out how to get the right position, mainly because it says that groupbox does not have the Locate property that I was going to use to get the position, and then set it using ScrollToVerticalOffset. One thing that I thought about typing this was to first press the jusmp button on the top group box, and then go straight to the right one, but it looks like a hack ish and I prefer to find the right way. :)
source share