So I just started using C# and am looking into creating a WPF program.

I was able to create the window and add in a TextBox of variable name console. How can I make console static such that I can access it statically across all my classes?

I tried to do one of these:

public partial class GUI : Window
    {
        static TextBox textConsole = null;
     
        public GUI()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            textConsole = console;
        }
   }

Such that I can access GUI.textConsole, but I get an error saying that another thread has access to the variable when I run the program.

Any ideas?

Can you maybe provide some more information about what it is you are trying to do? Choose static variables, if you are trying to share data.