Personally, I won't go chasing MVVM purity by making everything done in the viewModel and would cheat a bit saving some code for the code-behind. It's not that unusual that components aren't MVVM-ready out-of-the-box, and the "chase" can take time while customers lose value.
Up vote 0 down vote favorite share g+ share fb share tw.
Here is the flow of my problem: User clicks on "Save" button The "Save As" dialog appears for choosing the destination path Execute the RelayCommand of "Save" button 's click event Currently I do not have any idea about: How to open the dialog & execute the RelayCommand with EventToCommand binding How to pass the selected path of "Save As" dialog into the RelayCommand I am using MVVM Light library. C# .net wpf mvvm link|improve this question edited 3 hours agoJim2,1221824 asked 3 hours agoHoa Tran1444.
Personally, I won't go chasing MVVM purity by making everything done in the viewModel and would cheat a bit saving some code for the code-behind. It's not that unusual that components aren't MVVM-ready out-of-the-box, and the "chase" can take time while customers lose value. Anyway, for the current question there's this approach: Create an event in viewModel called OnSelectSavePath which returns string (filePath) On click viewModel raises an event Page/UserControl/Window subscribes to an event with a method that runs OpenFileDialog or something Page/UserControl/Window returns selected string from that method ViewModel receives string from an event and uses it to its fullest.
This way you correctly detach viewModel from the presentation layer (not giving out the details of selection form) while still providing the functionality needed. Another approach would be to define custom openFileDialog that would support MVVM. You would pass current viewModel to the dialog and the dialog would update the selectedPath property on the viewmodel.
Better yet, you could just do it in codeBehing and then call some method on the viewModel with the selectedPath property. That saves you all the trouble.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.