I am using the MVVM pattern and Prism and have 2 regions: BannerRegion and InputRegion. The BannerRegion hosts a BannerView which displays a client’s details (e.g. first name, last name) in several text blocks. The InputRegion hosts an InputView which has several text boxes which facilitate input of the same client details. The text boxes in the InputView are bound to properties in a ViewModel.
How do I get the text in the BannerView’s text blocks to update as the user types the client details into the InputView?
A possible solution I’ve been considering is injecting the same ViewModel instance into both views (as discussed here). Is this the best way to achieve what I want?
If you want the banner to be updated as the user is typing (updating the banner UI with every keypress) then you’d have to use the same viewmodel object (not just the same viewmodel class). You could use separate viewmodelclasses, but then you’d have to wire up some extra NotifyPropertyChanged events to get the two viewmodels to talk to eachother.