I'm currently working on a project, and for the sake of simplifying explanations, let's say that there are two tabs in a TabControl...
In one tab, you add folders to a ListBox.
In the other tab, there is a ListBox that displays all of the items in all of the folders you have added.
Each tab is a ViewModel (this is to simplify code, as dumping all the code in one ViewModel makes it hard to read and understand).
In order for this program to work, both ViewModels need to access the list of items: one because it has to display them, and the other because it has to add to them.
I am having trouble figuring how to do this. I initially thought that sharing data is bad and this shouldn't have occurred in the first place, but then I realised that I can't think of any other way to do this.
I am new to MVVM (this is my first real application using MVVM) and initally started using it, as I couldn't access data between classes, and thought MVVM would somehow sort this issue, but here I am again.
I would appreciate it if someone can tell me how I could do this, and potentially explain it with example code. I am also open to suggestions and constructive criticism to my methods.