Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何知道何时将项目添加到ItemsControl. 发生这种情况时,我需要滚动到顶部。我知道这里有另一个帖子使用行为注入来执行此操作,但这对我不起作用。 ScrollToTop被调用但结果不会滚动到顶部。有没有另一种方法可以在没有行为注入的情况下实现这种 MVVM 风格?
ItemsControl
ScrollToTop
看这里: MSDN 论坛(有答案的类似问题) 或这里: MSDN 文档(OnItemsSourceChanged 方法)
您可以在 ItemsSource 被触摸时引发事件,侦听该事件,并在引发该事件时调用 ScrollToTop。