我使用Prism的viewlocator连接View和ViewModel,并遵循惯例,将View放置在view文件夹内,将ViewModel放置在viewmodel文件夹内,并在viewmodel类的名称后添加后缀viewmodel。一切正常。我只是想知道如何将多个视图模型连接到单个视图?
例如,我有:
查看:CustomerView
在XAML中,我只使用:prism:ViewModelLocator.AutoWireViewModel="True"
ViewVodel: CustomerViewModel
现在我想添加CustomerViewModel2
,但是它不起作用,因为它与视图名称不匹配
将您的视图模型设置为部分类。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句