IBindingList support and DevExpress Grids

IBindingList support and DevExpress Grids

Old forum URL: forums.lhotka.net/forums/t/9406.aspx


mattruma posted on Thursday, August 19, 2010

I'm running into a problem where I can't get my collection to fire the AddNew from my DevExpress Grid ... I think the problem is because the DevExpress Grid supports collections that implement IBindingList (which prior to CSLA 4.0, the BusinessListBase did implement) ... the CSLA 4.0 BusinessListBase no longer implements this interface.

Any ideas on what to do?

JonnyBee replied on Thursday, August 19, 2010

In Csla4 use BusinessBindingListBase - in essence the csla 3.8.x  BusinessListBase has been renamed to  BusinessBindingListBase and implements the IBindingList interface.

 

dmnc replied on Friday, August 20, 2010

I'm having problems getting the WPF DataGrid to allow the user to add new rows when using BusinessListBase. It seems that only IBindingList exposes the AllowNew property. The concept of adding new items to a collection still exists in CSLA 4 though.

Do I have to replace BusinessListBase with BusinessBindingListBase to support adding new rows in a DataGrid?

mattruma replied on Friday, August 20, 2010

Hmmm ... didn't know that! Smile

So when should you class inherit from BusinessListBase verses BusinessBindingListBase? They are both still available.

tmg4340 replied on Friday, August 20, 2010

BusinessBindingListBase is intended to support the "legacy" UI technologies (e.g. WinForms) that require IBindingList, as it inherits from BindingList<T> (which implements IBindingList).  BusinessListBase is intended to support the newer UI technologies (WPF/SL), and it inherits from ObservableCollection<T>.

Which collection base class you use depends on what data-binding technology your UI supports.  WinForms only knows about IBindingList, WPF only partially supports IBindingList<T> (but fully supports ObservableCollection<T>), and Silverlight only knows about ObservableCollection<T>.  Because of these discrepancies, Rocky created the second inheritance hierarchy in CSLA 4.

HTH

- Scott

RockfordLhotka replied on Saturday, August 21, 2010

mattruma

So when should you class inherit from BusinessListBase verses BusinessBindingListBase? They are both still available.

It is a sad situation Microsoft and the datagrid vendors have created. When Microsoft decided that WPF wouldn't fully support IBindingList that was fine - we all felt that switching to ObservableCollection was inevitable.

But of course there are huge numbers of applications out there that rely entirely on the DataSet/DataTable/TableAdapter model - and those objects are entirely IBindingList-based. So there's a lot of pressure (I'm sure) on the datagrid vendors to make sure people can keep using their existing data objects with WPF datagrid controls.

So the datagrid controls support the older (essentially legacy) interface model, while the rest of WPF doesn't fully support that model.

This leaves us, as WPF users, in a nasty spot, where we have to choose the collection type we use based on the UI control set that is being used.

My recommendation? Switch to Silverlight where there is no IBindingList to cause confusion. And I'm only half-joking when I say that - Silverlight is just a simpler world because it doesn't have this legacy crap to deal with like WPF...

dmnc replied on Tuesday, August 24, 2010

Can anyone confirm that it is only possible to let the user add new rows in the default WPF Microsoft DataGrid when inheriting from BusinessBindingListBase? I couldn't get it to work when inheriting from BusinessListBase.

RockfordLhotka replied on Tuesday, August 24, 2010

That could be true.

I've tried continually to get the Microsoft WPF datagrid to work like the Silverlight one, and it consistently fails. I just figured the WPF datagrid was a crappy component, but maybe it just expects the use of legacy interfaces instead of the modern ones...

The Silverlight datagrid, on the other hand, works great - it is a joy to use :)

dmnc replied on Tuesday, August 24, 2010

It's a pity, if it's really true. One the one hand you get support for adding new rows with BindingList and on the other hand you have sorting and filtering capabilities with ObservableCollection.

vbbeta replied on Monday, August 08, 2011

Yes you right you want be able to use BusinessListBase on a devExpress grid unless you have in the BusinessListBase class a publiConstructor because the dataBindign have no idea about a FactoryMethod and as well it can access a Private Constructor so you have to use the BusinessBindingListBase

and while you look on this please let me know how work around on the EditLevel or BeginEdit CancelEdit on the DevExpress Grid 

 

Copyright (c) Marimer LLC