Monday, September 24, 2007

Linq Table and GetNewBindingList()

While I'm talking about binding linq data tables to WPF, I should mention the simplest method, namely Table.GetNewBindingList();

This method allows you to add/insert/update (even with Xceed's grid) quite easily, but does not save implicitly, ie. you have to manage it yourself.

If you prefer to batch up all your changes and save en mass at a special point (this is a common UI pattern) - then this might be a great solution for you.


One issue with with approach however, is that it only supports the whole table, ie. not based on queries. This might be fine if you are using the WPF's data filters, but it's not an optimal result with large amounts of data.


I'm planning to investigate these two aspects in the near future, and hopefully I'll find an elegant solution.

3 comments:

arco said...

Thank's for this useful post.
I wanted to ask if you've found anything on the topic?
The GetNewBindindList() is really "what I need", but I'd like it to accept queries as well.

Luke Marshall said...

Thanks arco!

The best I've found is Paul Stovell's SyncLinq.

It supports queries to be returned as a BindingList, which should work with the Xceed grid.

Unfortunately I haven't had the chance to test it yet, so if it works for you please let me know!

arco said...

Thank you very much Luke!

That's just an amazing thing Paul's working on!
I'll keep my eye on it...