SelectionChanged for DataGrid is being called multiple times after changing screen in conductor.

Topics: Bugs, Framework Services
Feb 22, 2016 at 3:09 PM

We've a conductor with two screens being displayed alternatively. Screen 1 has DataGrid which is attached with a method in ViewModel using ActionMessage for SelectionChanged event. Screen 2 has very basic UI. We change the screen by setting ActiveItem property of conductor on some event. Screen 1 is default for conductor and it works fine on load.

Problem is that SelectionChanged for DataGrid is being called multiple(like 3 times if I set viewmodel to ActiveItem thrice) times after changing the screens. It seems to me like event subscribers are being added for SelectionChanged whenever screen 1’s viewmodel is set to ActiveItwe.

Could you please help and let me know how to avoid the situation?

Thanks in advance.