Can I ask what is the goal of detecting if ScrollBar is pressed? If you need to know when it is scrolling or being dragged there are events you can attach to in the ScrollViewer:
About finding the bar, if you are using our NoesisTheme, the ScrollViewer template
contains horizontal and vertical scroll bars named respectively as PART_HorizontalScrollBar
. Calling the following code should get you the vertical scroll bar:
ScrollBar sb = (ScrollBar)scrollviewer.Template.FindName("PART_VerticalScrollBar", scrollviewer);
Isn't that working for you? Are you using your own template for the ScrollViewer?