Code I Use

  • rss
  • archive
  • Update TextBox Binding With Every Key Press (Windows Phone)

    MyView.xaml:

    <TextBox Text=”{Binding StringSample, Mode=TwoWay}” 
          TextChanged=”UpdateBinding”/>

    MyView.xaml.cs

    private void UpdateBinding(object sender, System.Windows.Controls.TextChangedEventArgs e)
    {
        var binding = (sender as TextBox).GetBindingExpression(TextBox.TextProperty);
        binding.UpdateSource();
    }

    • December 11, 2012 (2:56 pm)
© 2012–2013 Code I Use