title: Binding label to a variable
body: <p>I am just starting with WPF and I am trying to setup binding between a local variable and a label. Basicaly I want to update the label when local variable changes. I was searching for solution but they all just use textbox as a source not just class variable and I am not even sure it works this way. So here is my code.</p>
  
  <pre><code>public partial class MainWindow : Window
  {
      int idCounter;
  
      public MainWindow()
      {
          InitializeComponent();
  
  
          Binding b = new Binding();
          b.Source = idCounter;
          b.Mode = BindingMode.OneWay;
          b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
  
          myLabel.SetBinding(Label.ContentProperty,b);
      }
  
      private void Button_Click(object sender, RoutedEventArgs e)
      {
          idCounter++;
      }
  }
  </code></pre>
  
  <p>Button does work, idCounter changes value, but it does not update in label so I guess binding is wrong. Can someone tell me what is wrong? Thanks</p>