Sunday, February 26, 2012
WPF MVVM RelayCommand - Lambda expression for Execute
Like this:
// Get ViewModel - provided it is set on init or in XAML
MainWindowViewModel viewModel= (this.DataContext as MainWindowViewModel);
// aboutCommand lives in ViewModel
viewModel.AboutCommand = new RelayCommand( () => { About p=new About(); p.ShowDialog(); } );
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment