Editable Collection Adapter for WPF

The screenshot below is of a sample WPF application that deals with editing a collection of items:

The editable collection

A few features:

  • You can make a batch of changes to the screen and hit "Save".
  • If you deleted items, you can click "Show deleted items" to make them visible again, then click Undo to rollback the deletion
  • The list on the left is bound to the same collection as the list on the right - the changes aren't written to the source until you click Save
  • If you change an item, it highlights in bold
  • If you change an item, you can undo the changes via the Undo button
  • If you add items to the original collection, they will appear on screen (the Remote Update button)

The object representing an individual row is just a simple POCO object with INotifyPropertyChanged support - it has no HasChanges property or similar. Likewise, the collection is just an ObservableCollection<T>.

This is all implemented with a mix of BindableLINQ and the Editable Object Adapter.

Download

Note: This sample uses the Xceed WPF DataGrid control. If you have a license, you can use your license key when running the sample (just set it in App.xaml.cs). Alternatively, you can download a 45 day trial from the Xceed website.

A picture of me

Welcome, my name is Paul Stovell. I live in Brisbane and work on Octopus Deploy, an automated deployment tool for .NET applications.

Prior to founding Octopus Deploy, I worked for an investment bank in London building WPF applications, and before that I worked for Readify, an Australian .NET consulting firm. I also worked on a number of open source projects and was an active user group presenter. I was a Microsoft MVP for WPF from 2006 to 2013.

stephen patten
stephen patten
02 Oct 2009

Paul,

Glad to see you're back... Hope all is well.

Stephen