title: Making elements visible programmatically
body: <p>I know this question has been asked many times, but none are working for me. I am getting the error "An object reference is required for the non-static field, method, or property "...Question1Text"". I've read that this means I'm trying to use the type name, rather than an instance of it, but the advice I've found to fix it was to set the "Name" in the xaml, which I've already done. I have this code in my xaml:</p>
  
  <pre><code>&lt;TextBlock x:Name="Question1Text" Text="blahblahblah" FontSize="30" Visibility="Hidden"/&gt;
  </code></pre>
  
  <p>I want to change the visibility programmatically, and I try doing this:</p>
  
  <pre><code>Question1Text.Visibility = Visibility.Visible;
  </code></pre>
  
  <p>I'm trying to do this for other elements as well, things like buttons, and I can't seem to get it to work. Any help would be very much appreciated, Thanks. :)</p>
  
  <p>EDIT:</p>
  
  <p>Here is where the code is:</p>
  
  <pre><code>    public CooperationGame()
      {
          InitializeComponent();
          Loaded += OnLoaded;
  
          int question = 0;
          Question1();
      }
  
      private static void Question1()
      {
          Question1Text.Visibility = Visibility.Visible;
          Button1.Visibility = Visibility.Visible;
      }
  </code></pre>
  
  <p>It basically becomes visible when the class is called (when the window opens). And then when Button1 is clicked an event is fired that would hide these 2 things and make other text boxs and buttons visible.</p>