WPF ListView - Sorting by Nested Properties -


I have recently stumbled upon an issue where WPF ListView restricts the ability to control Organize its objects, in particular, I have a lot of trouble trying to get a order description to identify nested properties (properties of properties).

For direct-forward sorting by propreties, the following line should work:

  listView.Items.SortDescriptions.Add (new ordering ("MyProperty", ListSortDirection.Ascending ));  

And in fact it works well for me, however, because ItemSource for my ListView one (strongly typed Done) is DataTable , some columns are bound to the nested properties of the row (i.e. rowset.r.b.po.b.p.prototype binding path style) - this is the way that the ado Net dataset work for hierarchical databases.

What I would like to do is something like this:

  listView.Items.SortDescriptions.Add (new ordering ("MyProperty.SubProperty", ListSortDirection.Ascending));  

But unfortunately this line throws a logic exposure :

property of 'name' near the 'order' type is not. [ID] ', so the data collection can not be sorted.

Strange enough, I have no problem binding for nested properties. In fact, the field is displayed perfectly in the ListView ... nor does a PropertyGroupDescription connect to listView.GroupDescriptions with nested properties Give a problem - it's only sorted details !

Is this but a limit of WPF / ListView control? Either way, I am going to get support as part of the structure, or will I be out of luck? If I am unfortunately, and this is incompatible inevitable, then I would greatly appreciate that someone may suggest a hack or workaround for this scenario of nested properties. I have already tried some ideas, but with less success

Note: I know that an ORM can solve my problems, but I am afraid that it is not possible for the present project, I am working on it. Simple adonet datasets have to do.

According to the unknowingly (Adam Nathan) of the Windows Presentation Foundation, you can insert the default view into the ListCollectionView And you can set custom IComparer implementation in your CustomSort property.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -