How to change Master view with a button?

I have set master for a window. Inside this master, I have a window in different states and contexts. I want to add a bit of interaction, so when I click a button (inside master or outside master) the master state changes. I want to achieve the same effect as I would change dynamic panel states with a button. How to do that?