Fex329
New Coder
Hi, I am trying to get the button event below to, deactivate, set its content to the player Symbol and to change current player.
Unfortunatley, seems I cannot point to any of the Objects I created in MainWindow() here is the code
I have
Class called Player that has objects with 3 attributes, Name, Score and Symbol.
I am using a buffere Player object to hold the player playing now and the symbo that needs to be added as a symbol on the button (I am creting a TIcTacToe gme in WPF as practice)
The issues I have are
- The currentPlayer and the currentBoard ojecet I have instantiated "do not exist in the current context)
- The reference to the button created in WPF (TopLeftButton.Content = ....) also do not work same error
Unfortunatley, seems I cannot point to any of the Objects I created in MainWindow() here is the code
I have
Class called Player that has objects with 3 attributes, Name, Score and Symbol.
I am using a buffere Player object to hold the player playing now and the symbo that needs to be added as a symbol on the button (I am creting a TIcTacToe gme in WPF as practice)
The issues I have are
- The currentPlayer and the currentBoard ojecet I have instantiated "do not exist in the current context)
- The reference to the button created in WPF (TopLeftButton.Content = ....) also do not work same error
C#:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Player _player1 = new Player("Player 1", "X");
Player _player2 = new Player("Player 2", "O");
Player currentPlayer = new Player(_player1);
currentPlayer = _player1;
Board _currentBoard = new Board();
}
private void TopLeftButton_Click(object sender, RoutedEventArgs e)
{
this.IsEnabled = false;
TopLeftButton.Content = currentPlayer.Symbol;
currentBoard
}