ICollectionView cancel currentchanging

血红的双手。 提交于 2019-12-11 01:06:31

问题


I am looking for a way to cancel the CurrentChanging event depending on the item that was clicked. In my application I use ICollectionView to hold my list of viewmodels which are rendered as tabitems in a tabcontrol. For a specific viewmodel I need to do some property checking before the viewmodel can be activated. In order to do that I need to now that the specific viewmodel is going to be the next current item. Depending on the results of the property checking, the change of the current item should be allowed or canceled (only for the specific viewmodel). I don't want to do the property checking for all the other viewmodels.

Is there a way to have access to the next current item before it is set?

Edit:

Another idea: in the currentchanged event I do my property checking and depending on its result, I send a message to the parent view model (which contains the list of view models) to trigger it to move current to first. I would expect this to trigger a new current change event but it does not. The current item always is the view model that was selected before the first current changed event.

What's happening there?

来源:https://stackoverflow.com/questions/11472798/icollectionview-cancel-currentchanging

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!