private void UnLightUpBorderOnGrid(int row, int col) { // remove from UI Border b = GetLitSquareOnGrid(row, col); if (b != null) { MainGrid.Children.Remove(b); } // remove from list LitSquares.RemoveAll(l => l.x == row && l.y == col); }
private void LightUpBorderOnGrid(int row, int col) { // store the grid coordinate of the border in its name Border light = new Border { Background = Brushes.Red, Opacity = 0.6, Name = "lb_" + row.ToString() + "_" + col.ToString() }; light.MouseDown += LitSquareClicked; Grid.SetRow(light, row); Grid.SetColumn(light, col); MainGrid.Children.Add(light); LitSquares.Add(new coordinate(row, col)); }