In my silverlight application I need to send a notification from a ViewModel to a View. In response to it a method on a UI control should be called. I know about 2 ways to accomplish this:
1) Raise an event in the ViewModel and handle it in the View's code behind.
2) Send a message from the ViewModel (using the MVVM Light messaging support) and respond to this message in the View's code behind.
I'd like to know if there is a way to accomplish this without using code in the View's code behind, for instance through some kind of data binding in the XAML?
Please share any ideas.
Additional info about what the View should do when it receives notification from ViewModel
In the XAML of the View I declare an instance of a custom Silverlight grid control which has the following method:
public void FileExportFinished(bool fileExportSucceeded)
I want to call this method from the XAML in response to the notification received from the ViewModel passing a boolean value received with the notification.
DataTrigger
? – dvvrd