Artem Kyba
Artem Kyba

Reputation: 885

OnScrollShow event at DataGrid WPF

How to handle scroll showing event at DataGrid?

I tried to find some solutions, but there is no one.

Upvotes: 2

Views: 445

Answers (1)

Oren Hizkiya
Oren Hizkiya

Reputation: 4434

That DataGrid class does not have an OnScrollShow event. You can handle ScrollViewer.ScrollChanged for when the scroll changes. If you are more specific about what you are trying to accomplish then perhaps we can suggest how you can try to implement the functionality you desire.

In order to detect if the scroll bar is showing, you can hook into the LayoutUpdated event and use the code in this answer to detect which scrollbars are visible:

ScrollViewer scrollview = FindVisualChild<ScrollViewer>(dataGrid);
Visibility verticalVisibility = scrollview.ComputedVerticalScrollBarVisibility;
Visibility horizontalVisibility = scrollview.ComputedHorizontalScrollBarVisibility;

Upvotes: 2

Related Questions