I love the idea of MVVM but really struggling with the hoop-jumping required for really basic things like getting a value back from a modal dialog or closing a window. I mean...
App.xaml defines StartupUri=MainWindow.xaml.
MainWindow.xaml defines DataContext=MainWindowViewModel.
As per MVVM, View knows about ViewModel but NOT vice versa.
I can't find a (common? logical? straightforward?) way of intercepting the close event. I can use "clever" code blocks like MVVMLight .. but I always end up with either handling an event (messily) or not being able to cancel the close or missing it completely.
I refuse to believe this is so difficult - it must be me falling into another noobie pitfall. Please put me straight!
Thank you again for your time and patience - it is truly appreciated.
This is easily handled via attached properties or a Behavior. I wrote a sample on the Expression Gallery showing how you can use a Behavior to wire this handling up to a command in your VM without using code behind.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With