Esempio n. 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button bt = sender as Button;
            int    x  = (int)bt.GetValue(Grid.RowProperty) - 1;
            int    y  = (int)bt.GetValue(Grid.ColumnProperty) - 1;

            arr[x, y] = !arr[x, y];

            if (bt.Background == Brushes.Gray)
            {
                bt.Background = Brushes.Yellow;
            }
            else
            {
                bt.Background = Brushes.Gray;
            }
        }