mvvm - MvvmCross: Application wide view model? -


i loving mvvmcross far, new mvvm technique. mvvm seems center around view , viewmodel , navigating between them. however, application-wide model items? maybe application has mode can in affects views , viewmodel behavior. seems applicationmodel or applicationviewmodel. or maybe use app class store application wide stuff? recommended practice concept? if using app class idea, assume there easy way hold of reference app instance anywhere? haven't looked yet.

a viewmodel model view - that's current mvvmcross focus sits.

for application wide behaviour, think it's best consider 1 use case @ time.

the example you've provided is:

maybe application has mode can in affects views , viewmodel behavior.

there's not detail here, type of thing might perhaps:

  • place mode inside singleton service
  • would use messenger send modechangedmessages when mode changed
  • would provide service , messenger relevant viewmodels using constructor injection
  • the viewmodels can subscribe modechangedmessage on messenger
  • would perhaps use inheritance in viewmodels share code between them (ie they'd inherit baseviewmodel class)

there of course other ways this, that's 1 suggestion


if there's other application wide use case you'd ask about, please ask question - please include more detail - eg perhaps provide pseudo-code want share. find real use cases easier work out - abstract ideas harder talk about.


if helps:


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -