TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
claude hasler
NA
14
1.3k
MVVM multiple ViewModels and Views of Data
Apr 5 2019 12:37 PM
for a CAD like software I'm working on, my basic data model can for discussion be simplified to:
class Component{
public string Name{get;set;}
public List<Component> Children{get;set;}
}
A heirarchel data model with some descriptive properties.
In my program i wish to act on this data, namely change the data of the Components ( the name ) as well as the tree itself ( add / remove children).
Additionally i would like to display the data in several different forms:
-A TreeView of the tree structure
-A 3D View to visualize data
-A ListView for oversight over all Components
Currently my solution is to have a MainViewModel which holds the data (A "root" component) and then multiple SubViewModels ( TreeViewModel, 3dViewModel etc). Whenever a command is executed by the MainViewModel, say "AddComponent" the same Command is executed in the SubViewModels as well. While this works, it doesnt feel elegant to have to implement the same command in each ViewModel
What is the tried and true elegant way to display the same Model in several different Views, by several different ViewModels, and guarantee synchronicity across these?
Regards
Reply
Answers (
0
)
Please help me, how to merge two videos in one ???
Raise property on class that has the sub property