DelegateCommand CanExecute called after Navigation

2 replies. Last post: July 18, 2013 9:23 AM by Andrew Hoffmaster
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

I am currently developing a WPF application in the MVVM pattern that involves many pages of user navigation and some of the pages consist of many commands.  What I have noticed is that after navigating from one page to another, the CanExecute from my DelegateCommand of the previous view model are still called.  I use the UXNavigationButton to simply display a new page (<Intersoft:UXNavigationButton Content="Login"  HorizontalAlignment="Center"  Grid.Row="6" Grid.Column="1" VerticalAlignment="Top"  Style="{StaticResource NavButtonStyle}" NavigateUri="/MainPage" /> ).  My delegate commands are created in the view model and simply do a WriteLine every time a CanExecute event is triggered.  Is there a way to dispose the DelegateCommand after the current view and ViewModel are navigated away from?  I can foresee performance issues down the rode with a 10+ page application with many Commands.  

All times are GMT -5. The time now is 9:18 AM.
Previous Next