MVVM: How to show a dialog box from the ViewModel using Behaviors

יום ראשון, פברואר 6, 2011

Behaviors seems like the killer feature for every possible problem we used to have with MVVM. Thank god for WPF4 Showing a Message Box is one of those navigational problems that comes with MVVM. It’s something that we want the ViewModel to control, but yet we don’t want the ViewModel to contain any hard reference to the View. My solution uses the Messenger class from MVVMLight toolkit, but can easily be adjusted to use Prism’s EventAggregator. Lauren Bugnion suggested a solution a while ago which is to send a message to the view’s CodeBehind,...
תגיות: , , ,
18 תגובות

Adapting Silverlight Navigation to MVVM

יום שלישי, ינואר 25, 2011

  Adapting Silverlight Navigation to MVVM The Navigation feature in Silverlight is pretty awesome. It adds support for two very critical issues: 1. Real web-compliancy (Browser Address changes, which adds support for: SEO, Deep Linking, Browser Journal) 2. View-Switching navigation (switching views easily to solve the ever-lasting navigation problem) It’s important to notice that these two issues are actually completely different problems, which for some reason were bundled together! Many times you would want to switch views in different scenarios, but you might not want to change the Url, and even more often...