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.

Last revised: 13 Dec, 2009 07:27 AM History

Discussion

stephen patten
stephen patten
02 Oct, 2009 04:02 PM

Paul,

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

Stephen

Your Comments

Used for your gravatar. Will not be public.

Posting code? Indent it by four spaces to make it look nice. Learn more about Markdown.

Preview