Your ViewModel is designed to be the glue between the view and the model. This means that if you cannot repeat the model as a whole, it will always consist of a listing of βadhesive linesβ.
The only mess I can imagine is you can get rid of it if you don't need the XXXCommand properties literally; in this case, you can create a collection of properties, such as (pseudocode)
private void createCommands() { var commands={ "Logout"=>new RelayCommand(Logout), "Exit"=>new RelayComand( ()=>Application.Current.Shutdown() ), .... }; foreach( var key,cmd in commands ){ glue(key,cmd); } };
There is no other reason to maintain links to the objects you created, except that they glue them with the correct View insert.
But then again, why not use the Idiot Property for this? Again: the amount of clutter, as I see it, is quite limited.
xtofl
source share