MVVM : Share data between ViewModels

前端 未结 5 865
一个人的身影
一个人的身影 2021-01-02 00:25

How do I share data between multiple ViewModels ?

For example there is a class named Project in application .

    public class Project : ModelB         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-02 00:33

    I would create a ViewModel that acts as a parent to all the Project ViewModels. (Let's call it Solution)

    The Solution ViewModel would have the property ActiveProject and an observable collection of Projects.

提交回复
热议问题