I am having trouble trying to get a click event to fire after the command gets executed. I am trying to follow the MVVM style of development.
Here is the scenario:
In my application I have a grid of 2 by N buttons, where N is a dynamically loaded set of buttons (sometimes it'll be 2 x 2, sometimes its 5 x 9, I don't know). Initially, all the columns of buttons will be hidden except for the first column. Upon clicking the first column, a Command gets executed, and a fade in animation gets played and shows certain buttons from the second column, depending on which button was clicked in the first column. For example, clicking the top button in the first column will reveal the first four buttons in the second column, whereas the bottom button in the first column will reveal the first three buttons in the second column.
Here's the problem:
For each button, I set a CommandParameter to each of the buttons in the first column. When the command gets executed, data gets processed, and a property is set in the VM that says which button was pressed (I just use the CommandParameter again). While the data is being processed, I want to display the next set of buttons to the user. I have a click event that takes the CommandParameter from the VM and plays an animation to show the proper buttons.
However, the problem is that WPF likes to do the Click event first before the Command gets fired. This is a problem since the property in the VM that says which button was clicked doesn't get set!
So that brings me to a couple questions...
1) Is there a way to execute the command before firing the event?
2) Am I doing it right? :P