Alex Rivera | Logout

"UpdateSourceTrigger=PropertyChanged" equivalent for a Windows Phone 7 TextBox

Asked 2011-01-28T21:11:57.640
34

Is there a way to get a TextBox in Windows Phone 7 to update the Binding as the user types each letter rather than after losing focus?

Like the following WPF TextBox would do:

<TextBox Text="{Binding Path=TextProperty, UpdateSourceTrigger=PropertyChanged}"/>
Edit
Report

1 Answer

0

UpdateSourceTrigger=Explicit doesnt work for me, hence Im using custom class derivated from TextBox

public class TextBoxEx : TextBox
{
    public TextBoxEx()
    {
        TextChanged += (sender, args) =>
                           {
                               var bindingExpression = GetBindingExpression(TextProperty);
                               if (bindingExpression != null)
                               {
                                   bindingExpression.UpdateSource();
                               }
                           };
    }

}
answered 2012-06-25T21:57:21.570

Your Answer