我如何可以通过使用的NavigationService对象的ViewModels?可以通过、对象、NavigationService、ViewModels

由网友(谁会陪我一起变老)分享简介:我工作的这个项目是一个基于WPF应用程序桌面。我已经实现其中的MVVM模式。另外我使用统一的IoC和它Repository模式。 The project I am working on is a desktop based WPF application. I have implemented the MVVM pa...

我工作的这个项目是一个基于WPF应用程序桌面。我已经实现其中的MVVM模式。另外我使用统一的IoC和它Repository模式。

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.

我有一个主细节类型场景的一个问题。我导航到详细信息页面(我已经使用的IoC揭露的NavigationService在视图模型),但我不知道我怎样才能在EmployeeDetails视图模型的雇员没有打破MVVM模式。我不想写在后面的code什么。

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.

问候。

推荐答案

通常情况下,通过公开的属性 CurrentEmployee 实现这个EmployeeMasterViewModel 。此属性的数据绑定到主列表中当前所选的项目。 然后,您绑定的详细信息页面的控制,以 CurrentEmployee 的属性。

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.

阅读全文

相关推荐

最新文章