4

Is it a good or bad idea to have a ViewModel as a property of another ViewModel?

For example:

public sealed class ContentManagerViewModel : ViewModel
{
    public FindViewModel Find { get; set; }
}
Benjamin Gale
  • 12,977
  • 6
  • 62
  • 100
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152

2 Answers2

4

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 :)..

Cheers, Anvaka

Anvaka
  • 15,658
  • 2
  • 47
  • 56
2

Aggregate ViewModels you do only having relations between them. If thats the case you should better use the Mediator pattern with a concrete Messaging System.

Elisabeth
  • 20,496
  • 52
  • 200
  • 321