I trying to create some regions, and in one of that regions, I have button "login" and ICommand Login
property it is bound to. So I want to subscribe to this Login
from shell.
I tried PubSubEvent
, but I also need CanExecute
method.
Another solution I have found, is to use static class with static commands. This I think is not a good pattern.
How to do this right from pattern perspective?
EDIT 1
To assign a region, I invoke this in constractor of shell's view model:
regionManager.RegisterViewWithRegion("MainContent", typeof(LoginArea));
And in view I use this ViewModelLocator.AutoWireViewModel="True"
, so I could not inject my shell's view model to subscribe events to it.
Aucun commentaire:
Enregistrer un commentaire