title: Refresh WPF label
body: <p>I'm trying to dynamically refresh the label that shows the current amount of space remaining but unfortunately the number doesn't refresh. Do you have any idea how to solve my problem?</p>
  
  <p><strong>C#</strong></p>
  
  <pre><code>private void ReqDescText_Changed(object sender, TextChangedEventArgs e)
  {
       Counter ReqDescText_Counter = new Counter(ReqDescText, ReqDescLabelLength);
  }
  </code></pre>
  
  <p><strong>Class</strong></p>
  
  <pre><code>public class Counter
  {
       public TextBox InputTextbox { get; set; }
       public Label CounterLabel { get; set; }
       public Counter(TextBox InputTextbox, Label CounterLabel)
       {
            int NB;
            TextBox textBox = new TextBox();
            var tempText = textBox.Text;
            NB = (InputTextbox.MaxLength - tempText.Length);
            CounterNumber counterNumber = new CounterNumber { Number = NB.ToString() };
            CounterLabel.Content = counterNumber;
            if (NB == 0)
            {
                 CounterLabel.Foreground = new SolidColorBrush(Colors.Red);
            }
        }
  
        class CounterNumber
        {
            public string Number { get; set; }
            public override string ToString()
            {
                return "[" + Number + "]";
            }
        } 
  }
  </code></pre>
  
  <p><strong>WPF</strong></p>
  
  <pre><code>&lt;Label x:Name ="ReqDescLabel" Content="Description" Grid.Row="1" Margin="5,5,0,5" Grid.Column="0"/&gt;
  &lt;Label Name="ReqDescLabelLength" FontSize="10" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,6"/&gt;
  &lt;TextBox x:Name ="ReqDescText" Padding="3" Grid.Row="1" Margin="0,5,0,5" Grid.Column="2" TextWrapping="Wrap"  SpellCheck.IsEnabled="True" MaxLength="250" TextChanged="ReqDescText_Changed" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True"/&gt;
  </code></pre>
  
  <p><strong>How it's looks like</strong></p>
  
  <p><a href="https://i.stack.imgur.com/ybPqR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ybPqR.png" alt="enter image description here"></a></p>