I am fairly new to mvvm and mvvm light, but I think I understand the general idea of it. What I don't understand is if I want to open a new window, but that window needs data from the caller what is the best practice to get that data to the new window? If I pass the data to the constructor then that means I need code in the code behind to pass it to the view model. I can't use messaging, because it isn't basic data. Thanks in advance.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
One popular choice is to use a service class that will create a view/viewmodel and display the new view. Your view model constructor and/or method/property could receive the data from the caller and then the view would be bound to the viewmodel prior to displaying it on the screen.
here is a very very simple implementation of a DialogService: