How to check if a scrollviewer's scrollbar is pressed or not?
I figured I'd try to see if the scrollbar is currently focused, but if this isn't how you'd do that I would need to try something else. It seems I can't get the scrollbar from the scrollviewer in Noesis. I found this topic for WPF, but none of the solutions worked for me, they all couldn't find the bar.
-
-
sfernandez
Site Admin
- Posts: 2056
- Joined:
Re: How to check if a scrollviewer's scrollbar is pressed or not?
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 and PART_VerticalScrollBar. Calling the following code should get you the vertical scroll bar:
Isn't that working for you? Are you using your own template for the ScrollViewer?
Code: Select all
scrollViewer.AddHandler(ScrollBar.ScrollEvent, ...);
scrollViewer.AddHandler(Thumb.DragStartedEvent, ...);
scrollViewer.AddHandler(Thumb.DragDeltaEvent, ...);
scrollViewer.AddHandler(Thumb.DragCompletedEvent, ...);
Code: Select all
ScrollBar sb = (ScrollBar)scrollviewer.Template.FindName("PART_VerticalScrollBar", scrollviewer);
Re: How to check if a scrollviewer's scrollbar is pressed or not?
I have a continuous loading of messages when the scrollviewer gets to a certain point at the top, but this can't happen if the bar is pressed. I can try to listen to these handlers and track if it's being dragged on my own, thanks.
Who is online
Users browsing this forum: No registered users and 1 guest