MVVM - what is the ideal way for usercontrols to talk to each other

后端 未结 9 1306
失恋的感觉
失恋的感觉 2020-12-08 05:24

I have a a user control which contains several other user controls. I am using MVVM. Each user control has a corresponding VM. How do these user controls send information to

9条回答
  •  清歌不尽
    2020-12-08 06:10

    I think the best solution would be using Publisher/Subscriber pattern. Each control registers some events and attaches delegetes to events exposed by other controls.

    In order to expose events and attach to them you would need to use some kind of Mediator/EventBroker service. I found a good example here

提交回复
热议问题