iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
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.
You can try to enable IsAutomaticRequeryDisabled property of DelegateCommand. It specifies whether automatic require should be disabled.
Following snippet code shows how to enable IsAutomaticRequeryDisabled in the ViewModel.
class HomeViewModel : ViewModelBase { public HomeViewModel() { this.Cmd1Action = new DelegateCommand(ExecuteCmd1, CanExecuteCmd1, true); this.Cmd2Action = new DelegateCommand(ExecuteCmd2, CanExecuteCmd2, true); } ... }
Hope this helps.
Thank you so much. When the IsAutomaticRequeryDisabled property gets set to true the command gets disabled. I binding to the UXPage Unloaded Event with Interaction Triggers and set the IsAutomaticRequerDisabled to True there.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname