CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Winform Grid Sorting

rated by 0 users
Answered (Verified) This post has 1 verified answer | 5 Replies | 0 Followers

Top 200 Contributor
47 Posts
cmay posted on Wed, Feb 17 2010 12:01 PM

I think maybe I'm missing something here.

When I databind a normal businesslist to a windform datagrid, I don't get any sorting functionality out of the grid.   I think this is as expected.

I can simply do:

x.DataSource = new Csla.SortedBindingList(of Y)(Y.FetchList())

and that will cause all the sorting functionality to work correctly.

However, in Rocky's book, he says that SortedBindingList and FilteredBindingList are obsolete with the introduction of LINQ. 

Am I correct in thinking that using the sortedbindinglist would still be the ideal way to get sorting in a winform grid?  I don't see any simple way to get the same results using linq.

 

Answered (Verified) Verified Answer

Top 10 Contributor
3,922 Posts
Answered (Verified) Andy replied on Wed, Feb 17 2010 12:27 PM
Verified by cmay

Well, they are and they aren't.  They're obsolete really because of Wpf and SL, and WinForms is now being considered legacy technology. 

But if you're still on WinForms, you should continue to use those classes if needed, because WinForms doesn't understand Linq.

All Replies

Top 10 Contributor
3,922 Posts
Answered (Verified) Andy replied on Wed, Feb 17 2010 12:27 PM
Verified by cmay

Well, they are and they aren't.  They're obsolete really because of Wpf and SL, and WinForms is now being considered legacy technology. 

But if you're still on WinForms, you should continue to use those classes if needed, because WinForms doesn't understand Linq.

Top 200 Contributor
47 Posts
cmay replied on Wed, Feb 17 2010 1:32 PM

Thanks for verifying that for me.  I wasn't sure.

Any idea why the Sorting and Filtering were not built into BusinessListBase back before Linq was an option?

Top 10 Contributor
3,922 Posts
Andy replied on Wed, Feb 17 2010 2:09 PM

I think its because there's overhead associated with it, and if you don't need it you'd still pay the price. Sorting and filtering is often though just a UI concern, and so shouldn't be part of the business layer. Csla provided those as a convience.

Top 10 Contributor
1,813 Posts

Hi,

Sorting/Filtering is usually closely connected to functionality in the UI and as such should not be in the core BusinessListBase.

DataSets implement the IBindingListView interface (that supports sorting/filtering) but unfortunately - there is no generic implementation from Microsoft available. There is one open source implementation on SourceForge tho'.

Jonny Bekkum, Norway CslaContrib Coordinator

replied on Tue, Feb 23 2010 7:03 AM

It should also be noted that even in WinForms, the 3rd party grids handled their own sorting.  Well, at least the DevExpress one did, and I assume the others worked similarly.  I always figured that under the hood it was essentially doing the same thing as the Csla.SortedBindingList.

So, the point is there were a lot of scenarios, even in WinForms, where that code would have just been bloat if it were in the core.

Page 1 of 1 (6 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems