The sample demonstrates how to implement the MVVM pattern in a WPF application.
Step1. Build the sample project in Visual Studio 2012.
Step2. Click on the cells in the grid.
Step3. If one player has won the game, a messagebox pops up saying "XX has won,Congratulations!".
Step4. If all the cells in the grid are clicked, but no one has won, a messagebox pops up saying "No winner".
Step5. You can change the dimension of the game using the Game menu.
Cell class - represents a cell in the tic-tac-toe game grid
PlayerMove class - represents a player move in the game
TicTacToeViewModel - contains game's logic and data
MainWindow.xaml - contains a Menu and an ItemsControl
a. Attached behavior
ChangeDimensionBehavior - connect the MenuItem in the View to the TicTacToeViewModel in order to change the game's dimension
ShutdownBehavior - contains code to exit the application
GameOverBehavior - listen to the GameOver event on the TicTacToeViewModel and show a messagebox reporting the game result.
IntToBoolValueConverter - used to check/uncheck a MenItem that is used to change the dimension of the game
RelayCommand - provides an implementation of the ICommand interface
WPF Apps With The Model-View-ViewModel Design Pattern
Introduction to Attached Behaviors in WPF