Building Windows Store apps with HTML/JS and WinJS

Thanks to everyone who attended the WinJS marathon! Here's the slides and demos we did: WinJS.Demos … [Read more...]

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...]

Building RESTful services with WebApi

Thanks to all of you that came out to see my talk at NDDNUG last night on RESTful WebAPI, it was a lot of fun despite the Entity Framework issues!  Here's the demos and slides we went through … [Read more...]

Managing focus with MVVM in Windows Store Apps

One thing that is always troublesome in MVVM is focus-management. How can we push focus to a specific control during business logic processing and still keep a clean separation of UI and logic? There are likely several good solutions out there, but one I have used in the past is a Blend Behavior called SetFocusAction. I ported this behavior to the 8.1 Windows Store model (and it also exists in 8.0 as part of my full behaviors package with MVVMHelpers). Using it is pretty easy - let's pretend we … [Read more...]

MonoTouch.Dialog webcast

I did a webcast last week on using Monotouch.Dialog to build data-driven iOS applications with Xamarin.iOS. Thanks to all who attended - if you missed it, you can watch it here: Building Data Driven applications with Monotouch.Dialog and the sample applications are here: Enjoy! … [Read more...]

ViewModel triggers

A question I often get is how to drive behavior through MVVM where the activity is actually initiated on the ViewModel side. It's easy to see the other direction - where the UI raises a command or property change to cause something to happen. I often use one of two approaches when initiating state changes in the UI from the ViewModel. The first is to use property changes - since Data Binding is all about property change notification, you can easily make property changes and cause things to … [Read more...]

Behaviors in Windows 8.1 Store Apps

Visual Studio 2013 RC was released to MSDN this week and it includes some very cool new features which have been detailed on various blogs around the Internet.  One feature I've not seen much coverage of, but am very excited about is support for Blend behaviors.  If you create a new Windows Store application using the 8.1 profile you will find Blend behaviors in the Assets tab: The list of behaviors is small - compared to WPF and Silverlight, but all the important ones are there, along with a … [Read more...]

Making Async Popups in WSAs

The async and await keywords are awesome and allow for a much easier style of async programming over the traditional callback approach. Ideally, we could use these everywhere in our programming - particularly for UI environments such as Window Store apps. But not all the APIs are programmed this way in WinRT - take for example the Popup control. You show the Popup by setting the IsOpen property to "true" and then close it by resetting it to "false". This is a holdover from the WPF/SL world … [Read more...]

Mixing asynchronous and synchronous code

I had a question from a former student today related to a deadlock he was encountering in his Windows Store application. He had an interface which was already in use (and therefore could not be changed) which had to call a method that performs I/O. In WSAs (Windows Store Apps) all I/O is now asynchronous - so he used the async/await keyword which is the normal approach here. The problem was that he had to block waiting on the results due to the interface design. Here's a similar block of code to … [Read more...]