in Games/Fifteen/GamePage.xaml.cs [94:139]
void InitializeButtonArray()
{
GazeInput.SetInteraction(GameGrid, Interaction.Disabled);
GameGrid.Children.Clear();
GameGrid.RowDefinitions.Clear();
GameGrid.ColumnDefinitions.Clear();
for (int row = 0; row < _boardSize; row++)
{
GameGrid.RowDefinitions.Add(new RowDefinition());
GameGrid.ColumnDefinitions.Add(new ColumnDefinition());
}
_buttons = new Button[_boardSize, _boardSize];
for (int row = 0; row < _boardSize; row++)
{
for (int col = 0; col < _boardSize; col++)
{
var button = new Button();
button.Background = _solidTileBrush;
button.Name = "button" + "_" + col + "_" + row;
if (!(row == _boardSize - 1 && col == _boardSize - 1))
{
button.Content = ((row * _boardSize) + col + 1).ToString();
}
else
{
button.Content = "";
button.Background = _blankTileBrush;
}
button.Tag = (row * _boardSize) + col;
button.Click += OnButtonClick;
button.Style = Resources["ButtonStyle"] as Style;
_buttons[row, col] = button; ;
Grid.SetRow(button, row);
Grid.SetColumn(button, col);
GameGrid.Children.Add(button);
}
}
GameGrid.UpdateLayout();
}