Suppose I’m using the MVVM approach (Silverlight)
I’m having all my buttons handled with commands.
Suppose I have a button used to navigate to a certain page, say we selected a customer in a grid and want to navigate to the customer’s details view.
Can I handle this button with a DelegateCommand? How? Can I handle the navigation from the ViewModel? Am I forced to handle the navigation from the code-behind.
Here we go:
Xaml:
ViewModel:
Basically, the Command is bound to the button as per normal. The command is a property on the viewmodel. When the Command is executed it simply calls a private method in the viewmodel.