Category: WPF

Using await to build cool UI tutorials

In the last post we discussed how we can build custom awaiters and showed simple example how to await for click on the Button instance. Maybe it was not obvious how we can expand that idea and create some useful application, so i decided to expand the whole concept in this post. We are going to build some more complex awaiters (for example TextBox awaiter that awaits for certain text to by typed into it) and use it together with the old Button click-awaiter to build the tutorial on how to use some imaginary app inside of the app itself. Read More

Awaiting for that Button click

Why wait when we can await? I believe that most of C# developers know about the new language features for asynchronous programming with async and await keywords but how many of us are really exploiting them to full extent? Recently i was watching the excellent C# Language Internals course on by Bart De Smet and came across very cool idea of using Await to wait for Button to be clicked Рwhich pushed me to write this post and share it with everyone. By implementing a custom awaiter for Button (via extension methods) and hooking up to the Click handler Read More

Throttling Immediate TextBox Binding Behavior for Windows Phone

The learning curve of a Windows Phone developer 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. Code reuse is not a myth! This is really old problem. It existed in desktop Silverlight from the beginning. And it Read More

Custom Silverlight TextBox control that immediately updates DataBound Text property in TwoWay binding

Standard Silverlight TextBox control is very useful but has one strange behavior: if you use TwoWay data binding and bind some property to controls Text property, when users type text into the control, this change is not propagated to the bound property until the control loses its focus. This can be very annoying if you have MVVM application and you have some kind of real-time filter that needs to update some data as-you-type. Problem is that TextBox control does not call BindingExpression.UpdateSource when its Text property is changed so we have to do that manually in order to fix this Read More