聚合 ViewModel 是个好主意吗? [英] Is it a good idea to aggregate ViewModels?
本文介绍了聚合 ViewModel 是个好主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将一个 ViewModel 作为另一个 ViewModel 的属性是好还是坏?
Is it a good or bad idea to have a ViewModel as a property of another ViewModel?
例如:
public sealed class ContentManagerViewModel : ViewModel
{
public FindViewModel Find { get; set; }
}
推荐答案
很好,如果有帮助的话.但这一切都取决于.
It's good, if it helps. But it all depends.
通常我确实有聚合的视图模型.例如.我可能有一个主窗口视图模型.它可能由不同的部分组成.每个部分可能是一个单独的视图模型...
Usually I do have aggregated viewmodels. E.g. I may have a main window viewmodel. It may consist of different parts. Each part may be a separate view model...
如果您能描述您的特定架构,我们可能会提供更好的建议:)..
If you could describe your particular architecture, we may give better advice :)..
干杯,安瓦卡
这篇关于聚合 ViewModel 是个好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文