How can I know when ItemsSource changes?

2019-08-26 09:29发布

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?

2条回答
该账号已被封号
2楼-- · 2019-08-26 09:55

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

查看更多
登录 后发表回答