title: Assign data to from TextBox to variable (C#, WPF)
body: <p>Into xaml I have textBox:</p>
  
  <pre><code>&lt;TextBox Text="{Binding Path=LoginName}" Style="{StaticResource myTextBox}" /&gt;
  </code></pre>
  
  <p>Now I want to assing this value to my string variable ("userLogin"):</p>
  
  <pre><code>private static string userLogin;
  public static void SetUser()
  {
          userLogin = LoginName.text; //ToString();
  }
  </code></pre>
  
  <p>that later on into other method I will use this userLogin, as below:</p>
  
  <pre><code>static async Task&lt;string&gt; SomeTest() {
  ...
    if (method == "authenticate")
        jsonString = "{.... + userLogin + ...}";
  ...
  }
  </code></pre>
  
  <p>What I'm doing wrong? How correctly it's should be done? Maybe SetUser is not necessary?</p>