NumericTextBoxBehavior for XAML-based Windows Store Applications

One of the first (and arguably most useful) behaviors that I wrote for MVVMHelpers was a NumericTextBoxBehavior.  This is a WPF behavior that restricts the input for a TextBox to be numeric-only.  Recently, someone emailed me asking if it was possible to do the same thing in a Windows Store application.  It absolutely is, but there are some caveats. My original implementation for WPF utilizes preview events - these are events which are sent to the ancestors of the element prior to it receiving a … [Read more...]

Default and Cancel button behaviors

One of the things I miss from WPF moving to Windows Store Apps is the ability to define a "Cancel" and "Default" button.  These are buttons which are automatically invoked when you press ENTER or ESC.  A prompt from a fellow developer got me to thinking about how we could accomplish this with an attached behavior until Microsoft decides to add the support into the framework.  Here's the usage I wanted:   A few rules: It should not invoke the default or cancel buttons if they … [Read more...]