Interest to know why there isn't a completed-type event in the ViewModeBase? Bascially I'd like one VM that refers to another to know when the latter is ready.
I have a PropertyChanged and ErrorOccurred event but no specific "I'm ready" type event.
I don't know ViewModeBase well. But what about PropertyChanged of IsBusy ?
I'm thinking PropertyChanged wouldn't be a good idea generally because, for example, the VM in question could be busy for any number of reasons. What I'll likely do is inherit VMBase and implement my ow set of methods and events that I find useful for my apps. It'll likely closely mirror what I already do in base presentation classes in winforms.
Just curious to know if I'm not missing something about the mvvm pattern that I'll only get when it's too late.
You can certainly add your own even when you create your viewmodel base class that inherits from ViewModelBase.
The reason there isn't an event like that is because the most common usage scenario is the sort of thing you are talking about, and if one is not extremely careful you'll end up with circular references and memory leaks. Remember that handling an event means the event source now has a reference to the object containing the event handler method.
What's really needed to solve this sort of issue is a pub/sub technology that uses weak references. The major MVVM UI frameworks have event/message routers built into them for this purpose.
The ViewModelBase class intentionally limits the number of public members, with the assumption that you will create a viewmodel base class of your own (by subclassing ViewModelBase) that fits smoothly into the UI framework you adopt.
Thank you for this reply. It is extremely useful to me in terms of injecting caution where i hadn't considered there to be a problem. Once its spelt out it, of course, makes perfect sense.
Copyright (c) Marimer LLC