Throttling Immediate TextBox Binding Behavior for Windows Phone

added by spavkov
6/6/2012 8:42:22 AM


While developing Offline Web Browser for Windows Phone i had to build a small MVVM framework in order to keep the logic out of the views. One of the first thing i found missing was a way to force immediate propagation of text entered in TextBox control to the databound property of my ViewModel. By default, TextBox binding is triggered only when control loses focus, and this is kind of lame.


6/6/2012 8:42:05 AM
Nice, simple, reusable solution to a somewhat complicated problem (when to accept user input). I feel that especially on mobile platforms, losing focus is not really the best way to handle input. It would be nice to see something like what you've done built into the platform.

6/6/2012 10:27:57 AM
Thanks for the feedback.

I also felt that this needs to be solved and built into the wp7 platform but it seems that they were maintaining compatibility and also 'features' and bugs :)

Anyhow at least the Rx is included there.

And writing Behaviors is fun and you get the reusable behavior so I'm ok doing it once.

6/6/2012 8:58:08 AM
I'm pretty new to the Windows 7 Phone space but does that not seem like a crap load of code just to register textbox input per keystroke as opposed to after focus has left...? Or am I out to lunch here lol

6/6/2012 9:00:44 AM
Well, it's ~50 lines of code to create a textbox control, so that code is really only written once. I don't think it's a lot to get such a nice addition to UX.