AvaloniaUI / Avalonia.Controls.TreeDataGrid

A combined TreeView/DataGrid for Avalonia.
MIT License
278 stars 58 forks source link

Heterogeneous TreeDataGrid nodes #189

Open acgrama opened 1 year ago

acgrama commented 1 year ago

I want to use the TreeDataGrid in order to show a hierarchy with heterogeneous elements. All samples I have seen use nodes of the same type (e.g., Person).

For simplicity and because I cannot share confidential data about my use case, let's say my data structure is similar to a Team -> Players structure. The Team has a name and a city, while a Player has a name and age. (In my particular use case, there will be only one level of depth, like in this toy example)

I have implemented this using a fictitious TeamPlayerNode that mixes both classes Team and Player - this is a screenshot from the resulting UI, and it is roughly what I want to achieve: heterogeneous tree grid

My question: Is there a cleaner way to implement this? I am concerned with the "cleanliness" of my code going forward with this hybrid TeamPlayerNode.

chenjing1294 commented 5 months ago

I have the same problem, TreeDataGrid doesn't seem to be able to do it currently