private void SetUpBoard() { ChessSquare chessSquare; bool grey = false; for (int column = 0; column < 8; column++) { for (int row = 0; row < 8; row++) { chessSquare = new ChessSquare(grey); chessSquare.SetValue(Grid.ColumnProperty, column); chessSquare.SetValue(Grid.RowProperty, row); chessSquare.SetPicture(board[column, row]?.BitmapImage); ChessBoard.Children.Add(chessSquare); grey = !grey; } grey = !grey; } }
private void SetUpBoard() { ChessSquare chessSquare; bool grey = false; for (int column = 0; column < 8; column++) { for (int row = 0; row < 8; row++) { chessSquare = new ChessSquare(grey); chessSquare.SetValue(Grid.ColumnProperty, column); chessSquare.SetValue(Grid.RowProperty, row); chessSquare.MouseDown += ChessBoard_MouseDown; chessSquare.SetPicture(board.GetSpace(column, row)); chessSquareBoard[row, column] = chessSquare; ChessBoard.Children.Add(chessSquare); grey = !grey; } grey = !grey; } }