Browsing articles in ".NET Technologies"
May
4
2010

Refactoring: Extracting the Singleton Pattern

In this post, I show how to extract a Singleton Pattern, to reduce coupling and improve testability by using the Dependency-Inversion Principle

Jul
6
2009

A view model base class to use with MVVM in WPF

A view model base class to use with MVVM in WPF, with caching of PropertyChangedEventArgs for each property.

Jun
16
2009

Using Data Binding with Static Resources in WPF

In this post, I’ll be showing how to use resources for which you don’t know in design time the key to use in xaml (maybe because you’re loading them dynamically), by binding them to view model properties.

Apr
28
2009

An Introduction to ObservableCollection in WPF

This post discusses ObservableCollection, used in WPF data binding. It describes its basic uses, along with some sample code to help you better understand how it all works.

Apr
13
2009

Creating a Custom Observable Collection in WPF

One of the biggest advantadges WPF has is its Data Binding features. Data Binding can be done in several ways, but the most common is using the INotifyPropertyChanged and INotifyCollectionChanged interfaces. For simple objects, all you need to do is implement the INotifyPropertyChanged, and raise the PropertyChanged event when your properties change. When you want to bind to a collection, you will want to use ObservableCollection<T>. This collection implements both interfaces, therefore notifying you when the items in the collection change and when the items’ properties change. This works great if you’re using standard collections. The problem arises when you want to use a custom collection. For databinding to work with custom collections, you will have to create a new “Observable” wrapper around it.