开发者

How can I pass objects to ViewModels using NavigationService?

The project I am working on is a desktop based WPF application. I have implemented the MVVM pattern in it. Also I am using Unity IoC and the Repository Pattern in it.

I have a problem in a master details type scenario. I navigate to the details Page(I have used IoC to expose the NavigationService in the ViewModel) but I 开发者_运维技巧dont know how can I get the employeeID in the EmployeeDetails ViewModel without breaking the MVVM pattern. I don't want to write anything in code behind.

Any pointers will be very helpful.

Regards.


Normally, you achieve this by exposing a property CurrentEmployee in your EmployeeMasterViewModel. This property is data bound to the currently selected item in the master list.
You then bind the controls of the details page to the properties of CurrentEmployee.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜