© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
16 replies
Cin

MVVM - View model with collection of view models?

Within MVVM, can a view model have a collection of view models?

Is it okay to do:
class BasketViewModel
{
public ObservableCollection<ItemViewModel> Items {get; set;}
}
class BasketViewModel
{
public ObservableCollection<ItemViewModel> Items {get; set;}
}

Please assume ItemViewModel exists somewhere in the code base.

If this is acceptable, where should this collection be initialised from? The constructor or somewhere else?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ MVVM: Are models observable?
C#CC# / help
3y ago
MVVM should model items have INotify?
C#CC# / help
16mo ago
How to Properly Synchronize ViewModel and Model in MVVM (CommunityToolkit.Mvvm)
C#CC# / help
11mo ago
❔ Models data is not showing in view with help of ViewData
C#CC# / help
4y ago