Q:

Using MVVM to Change an Applications Theme

All, I am new to MVVM, so please be gentle. I have just learnt how to bind a basic 'model' or data to the view in WPF using MVVM. I am now embarking on a new application, and the first thing I would like to use MVVM for is to facilitate the quick change/development of new colour themes for the application. I am attempting to do this according to some basic tutorial I read online, but I have become confused over the best way to achieve what I want. 
I have seen WPF and MVVM - changing themes dynamically but this does not help me; instead fuels more questions. What is the best way to do what I want? and how do I achieve it using MVVM?
If some one could provide a basic outline I would be very grateful. 

A:

Having MVVM doesn't mean you'll have no code behind. In fact, having solely UI related concerns in your ViewModel could be a code smell. Why not let the UI do its thing?
public interface IMainView {
   void ChangeTheme(string themeName);
}

public class ViewModel {

   public IMainView View { get; } //get the view somehow
   public ICommand ChangeThemeCommand { get; }

   private void OnChangeThemeCommandExecute(string themeName) {
      View.ChangeTheme(themeName);
   }
}

With this approach you can test the invocation of the Command and delegation of that to the View (if that's worth testing). You still have separation of concerns and some testability.

