[WPF4] Scroll animation with ListBox.ScrollIntoView RRS feed

  • Question

  • Hi,
    I am programmatically scrolling to a requested item and it works:

    DomainList.ScrollIntoView(localData.FlatLocalInfoList[localData.FlatLocalInfoList.Count - 1]);
    DomainList.ScrollIntoView(localData.FlatLocalInfoList[(setNumber - 1) * 5]);

    Visually the list is just updated. I would like to have an animation showing the last scroll. How do I achieve that?


    Friday, January 27, 2012 8:33 PM


All replies

  • Hi MsdnDev,

    You can have a timer and scroll into the target item gradually.

    Check http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer.aspx for more about DispatcherTimer.

    If you encoutner any problems, feel free to let me know.

    Best regards,


    Min Zhu [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by MsdnDev Monday, January 30, 2012 7:55 PM
    Monday, January 30, 2012 1:35 AM
  • For completeness,
    I first get the scroll viewer object:



    border = VisualTreeHelper.GetChild(DomainList, 0) as Decorator;
    if (border != null) {
      // Get scrollviewer
    scrollViewer = border.Child as ScrollViewer;

    and then use the DispatcherTimerto scroll.


    Monday, January 30, 2012 7:57 PM
  • Should we have a better solution? Such as using animation.

    Friday, October 3, 2014 7:50 AM