I have a Flyout with content that is longer than the length of the Flyout, so a vertical scrollbar is activated. I wish to get the underlying ScrollViewer so that I can reset the scroll position everytime the Flyout is closed.
Tried getting the content of the flyout, but could not find the ScrollViewer in the Visual Tree.
This should work using the
Closing
event:NOTE
FindDescendant
comes from the CommunityToolkit.WinUI.Extensions NuGet package. Of course, you should be able to also use theVisualTreeHelper
to get theScrollViewer
.