开发者

How can I know when ItemsSource changes?

开发者 https://www.devze.com 2023-02-08 23:23 出处:网络
How can I know when items are added to or removed from an ItemsControl开发者_运维问答.I need to scroll to the top when this happens.I know there is another post on here for doing this using behavior i

How can I know when items are added to or removed from an ItemsControl开发者_运维问答. I need to scroll to the top when this happens. I know there is another post on here for doing this using behavior injection, but this doesn't work for me. ScrollToTop is called but the result is not scrolled to the top. Is there another way to do this MVVM style without behavior injection?


Look here: MSDN Forums (similar question with answers) Or here: MSDN Documentation (OnItemsSourceChanged method)


You could raise an event when ItemsSource is touched, listen for that event, and call ScrolToTop when that event is raised.

0

精彩评论

暂无评论...
验证码 换一张
取 消