Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to animate the BringIntoView method in WPF?

Is it possible to animate the BringIntoView method in WPF? We want a nice animated transition of our ScrollView rather than having it just jump to the contained control. How do we do this?

like image 987
Mark A. Donohoe Avatar asked Feb 28 '12 02:02

Mark A. Donohoe


1 Answers

The BringIntoView raises the RequestBringIntoView event that bubbles up from that element. Typically that is handled by a ScrollViewer which queues the request and then ultimately calls the MakeVisible of the Panel in the ItemsPresenter (if it implements IScrollInfo and the CanContentScroll is true) or that of the ScrollContentPresenter. So either you would need to intercept the BringIntoView before the ScrollViewer catches it or you would need a custom Panel that implements IScrollInfo (i.e. it handles its own scrolling) and then you can determine how to make the container visible.

like image 147
AndrewS Avatar answered Sep 19 '22 01:09

AndrewS