title: Wpf TextBox logger - Automatically update
body: <p>I am using an TextBox in WPF as logger.</p>
  <p>I write a message for each step</p>
  <pre><code>internal void WriteInfoMessage(int lognr, string v)
  {
      try
      {
          tb_log.Text += &quot;\n&quot; + v;
      }
      catch (Exception ex)
      {
           System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate { tb_log.Text += &quot;\n&quot; + v; });
                  tb_log.ScrollToEnd();
                  tb_log.BeginChange();
      }
  }
  </code></pre>
  <p>Problem is that it is update when a MessageBox is coming or when main method is finished. How can I update it every logging?</p>
  <p>Main method piece of code</p>
  <pre><code>public void MainMethod()
  {
      controller.WriteInfoMessage(Lognr, $&quot;Vorlage holen von systemCFG [MH]TemplatePositionName&quot;);
      string position_TemplateName = sys.GetProfileString(&quot;MH&quot;, &quot;TemplatePositionName&quot;, &quot;TestTemplatePosition&quot;);
      Iposition_std masterObj = controller.GetOrderTemplate(position_TemplateName).masterobject as Iposition_std;
      controller.WriteInfoMessage(Lognr, $&quot;Masterobjekt ist -&gt; {masterObj}&quot;);
          
      string topOrderName = controller.GetTagName(doc, &quot;wbs&quot;);
      log.WriteInfo(Lognr, $&quot;TopOrder name is : {topOrderName}&quot;);
      controller.WriteInfoMessage(Lognr, $&quot;Projekt -&gt;  {topOrderName}&quot;);
          
      string basicorderName = controller.GetTagName(doc, &quot;cs&quot;);
      log.WriteInfo(Lognr, $&quot;basicorder name is : {basicorderName}&quot;);
      controller.WriteInfoMessage(Lognr, $&quot;Auftrag -&gt;  {basicorderName}&quot;);
          
      string positionName = controller.GetTagName(doc, &quot;id&quot;);
      log.WriteInfo(Lognr, $&quot;Position name is : {basicorderName}&quot;);
      controller.WriteInfoMessage(Lognr, $&quot;Position (Leitschaufel) -&gt;  {positionName}&quot;);
          
      createdPosition = controller.CreateStrucure(masterObj, ConfigFile, positionName);
      log.WriteInfo(Lognr, $&quot;New position created : {createdPosition}&quot;);
      controller.WriteInfoMessage(Lognr, $&quot;Neue Position (Leitschaufel) wurde erstellt {createdPosition}&quot;);
  }
  </code></pre>