A
A
Abc Edc2016-07-08 11:07:51
WPF
Abc Edc, 2016-07-08 11:07:51

What are the ways/best practices to pass data between ViewModels?

A simple use case: I go
from the list of news page to the page with the full news, you need to transfer the news itself and the 3 following news, after a little googling, I found the implementation of Messenger. How much is the best implementation for this use case? and how good it is in general in passing data between ViewModels.
The first use case is complicated: in addition to the news list page, I can get to the news from another page, here I don’t have the news itself, but only the id. I take Messenger again, I subscribe all in the same instance but to another event, now which listens to the transition from another page with and with other parameters. Doesn't it look so pretty to me? Or is it still ok? And further - the moment of loading confuses a little, namely, passing the parameter to the container when registering for an immediate instance. That is, when bootstrapping the application, the class for displaying the full news is immediately initialized in order to listen to the Messenger's transition throughout the entire application. Please point me to the right path.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question