Flattened TreeListView Column Sorting

Grids for WPF Forum

Posted 6 years ago by Darcy Davidson
Version: 18.1.0672
Avatar

Hi,

I am trying to implement column sorting on a flattened tree list view.  I have captured the column clicks, set the column's sort direction (which as far as I can tell is just GUI manipulation), and implemented a custom IComparer on my underlying observable collection's default ICollectionView, and called it's refresh method (and confirmed that the sorting is working as desired by inspecting the ICollectionView's internal list).  I can't determine why my view doesn't follow suit.

Thanks,

D'Arcy

[Modified 5 years ago]

Comments (4)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi D'Arcy,

Yes the column.SortDirection just is pure GUI and shows the column header glyph.  If the UI isn't updating, perhaps the control isn't getting a notification that the collection changed.  Are you positive that whatever collection/view you are using for the children is implementing INotifyCollectionChanged and raising its events properly?  If not, then our control UI won't update on changes.  I'd first verify that.


Actipro Software Support

Posted 6 years ago by Darcy Davidson
Avatar

Thanks,

Sent sample app to support address.

Regards,

D'Arcy

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Thanks for the sample.  The error was that in you adapter.GetChildren method, you were returning "lvr.Children" instead of "_collectionView".  If you change that, it works fine since _collectionView is what you are sorting and properly notifies of changes..


Actipro Software Support

Posted 6 years ago by Darcy Davidson
Avatar

Thanks!  Admittedly i am a little confused, as my understanding is that bindings to observable collections are essentially binding to the underlying default CollectionView, so it seems wierd that I have to expicitly return the CollectionView as opposed to the ObservableCollection. (With other controls I have never had to do this).

Anyways, moving on, and not losing any sleep.

Thanks again.

[Modified 6 years ago]

The latest build of this product (v24.1.2) was released 2 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.