Editable Collection Adapter for WPF

This is an old post and doesn't necessarily reflect my current thinking on a topic, and some links or images may not work. The text is preserved here for posterity.

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.