Published by on March 20th, 2012 3:39 pm under Code
Getting Started: An ASP.NET MVC site that lists customers Download all the code here. This section is the vanilla MVC to set the stage for talking about AJAX and JSON payloads later on. This should all be very familiar to ASP.NET MVC developers. 1. First, wel add a very simple customer model. public class Customer... read more
Published by on October 19th, 2011 5:54 am under Code
Revision: Behavior problems In my original post I provided a behavior (ViewModelBehavior) for provding a view model for the given DataContext. The behavior saved away the original DataContext as the model, set DataContext of the AssociatedObject to the view model, and passed the model to the view model. This worked in 90% of the basic... read more
Published by on October 12th, 2011 8:33 am under Code
M-V-VM encourages POCO view models M-V-VM is one of the design patterns that help separate concerns between presentation and data: The model is concerned with data and knows nothing of the view or view model. The view is concerned with presentation. It only knows about the view model or model through data binding. The view... read more
A better M-V-VM library There are several existing libraries that support the Model-View-ViewModel (M-V-VM) pattern. They each have some nice features. However, I didn’t find any that were just M-V-VM. Some required me to fundamentally restructure my XAML. Others required me to use dependency injection or implement a view model locator pattern. A few required... read more
As part of the talk I gave on Modularity with Prism today, I created a very small modular application. The Simplest Modular Application This WPF application allow you to type different commands into a text box and see the result in a textbox below. The app has just has 1 module – the MathModule –... read more
Published by on June 29th, 2011 12:04 am under Code
Yesterday I got the opportunity to talk about Unit Testing and MOQ at a WPF/Prism conference in Boise put on by Karl Shifflett (Microsoft). I had a great time and appreciate how the attendees were so engaged in the talk even at the end of day. Unit Testing Scenarios I covered the following unit testing... read more
Published by on March 15th, 2011 8:35 am under Code
WPF Support WPF provides excellent support for shortcut keys: The InputBinding class supports Key, Mouse, and recently Touch gestures. An InputBinding can be associated with any UIElement using the InputBindings property. Custom controls that handle RoutedCommands can associate InputBindings using the CommandManager.RegisterClassInputBinding. The CommandManager provides tunneling and bubbling of the commands allowing any control with a... read more
Published by on August 14th, 2010 8:08 am under Code
I recently got the time to play with the IIS Transform Manager and the X264 encoder. I’ve created a Transform Manager task that allows for using X264 to encode videos by dropping files into a watch folder. I based my work off of Ezequiel’s excellent blog post about integrating the RCE with Transform Manager. While... read more
Published by on May 22nd, 2010 7:30 am under Code
en español Awhile back, I needed to have one object calculate a total across a collection of items for a value that changed regularly. Using a just-in-time calculation wasn’t efficient due to a large number of items and some complexity in the total calculation. I first tried implementing and using INotifyPropertyChanging. This caused some small performance... read more
Published by on May 19th, 2010 4:19 am under Code
en español Last week I needed a way to get at the property values in a class (instance) by name. The class implementing the properties and the class accessing the properties needed to be independent. I also didn’t want to implement a class per property (way too much typing), and I didn’t want to have to instantiate anything... read more