User (Old forums)MemberFebruary 13, 2007 at 12:10 pmPost count: 23064
Is it possible to have a tree view in a data grid control ?
With the basic controls of WPF(TreeView, GridViewRowPresenter and HierarchicalDataTemplate), I have something that works.
I’m trying to figure out how to do the same thing with the data grid control but I didn’t find a way.
Imported from legacy forums. Posted by Sébastien (had 6222 views)User (Old forums)MemberFebruary 13, 2007 at 1:15 pmPost count: 23064
Could you please provide more details on what you are trying to achieve?
Imported from legacy forums. Posted by Pascal (had 795 views)User (Old forums)MemberFebruary 13, 2007 at 2:20 pmPost count: 23064
I have two types of data : Client and Account.
A client can have multiple accounts or no accounts.
Both Client and Account have the same columns to be shown : Name, Amount, Currency.
Is there a way to easily show both client and account data in the same grid.
By default, only the client data is shown.
Usually, in a tree there’s a ‘+’ icon that indicates that there is “sub-data” and when you click on it, the icon changes to ‘-‘ and the “sub-data” appears.
The data could look like this:
+ Client1 1000$ USD
+ Client2 500$ USD
+ Client3 500$ USD
After a click on the ‘+’ icon of Client2, the data would look like this:
+ Client1 1000$ USD
– Client2 500$ USD
Account2-1 250$ USD
Account2-2 250$ USD
+ Client3 500$ USD
Imported from legacy forums. Posted by Sébastien (had 492 views)User (Old forums)MemberFebruary 14, 2007 at 4:05 pmPost count: 23064
There are many ways to approach this. I’ve built a small sample that shows one option, you can find it here:
My goal was to show that it is feasible, but this sample has some limitations, most of which are due to the fact that my sample sets the Visibility property to Collapsed on the Account DataRows that must be collapsed:
– The RowSelectors for collapsed rows will still be displayed
– If you have 1000 DataRows that are collapsed, those 1000 rows will exist in the VisualTree (they will not be virtualized)
– Paging (PageUp/PageDown) might not always work as expected
– The expanded/collapsed state of a Client has to be preserved in a property on the Client data object
Ideally, you’d bind the DataGrid (ItemsSource) to an ObservableCollection which would be a flat view of your Clients/Accounts. That collection would manage the expanded/collapsed state of each Client, and whenever a Client becomes expanded or collapsed, you would add or remove the corresponding Accounts from the collection.
This would remove all the limitations listed above.
Hope this helps!
Imported from legacy forums. Posted by Pascal (had 986 views)User (Old forums)MemberFebruary 20, 2007 at 8:05 pmPost count: 23064
I tried out the sample. I have the following comments
1. Sorting will screw up the Grid parent – child relation.
2. The check box version does not look good.
– Root 100 100
– Child 10 10
– child2 10 10
+child3 10 10
+child4 10 1
something like the link
which is for .net2.0
Imported from legacy forums. Posted by Mathew (had 507 views)User (Old forums)MemberMay 16, 2007 at 10:37 amPost count: 23064
We have corrected this issue, you can obtain the latest version <a href=”http://download3.xceedsoft.com/Packages/3.0.7264.16200/XceedComponents.exe”>here</a>.
Imported from legacy forums. Posted by Matt (had 5129 views)User (Old forums)MemberJuly 8, 2009 at 10:00 pmPost count: 23064
is there a new link to this file? i would like to check it out.
Imported from legacy forums. Posted by Aran (had 2051 views)Diane [Xceed]ModeratorJuly 13, 2009 at 5:02 pmPost count: 1353
You can find it on the following page:
However that package is from May 2007, I recommend downloading a more recent one instead.
Imported from legacy forums. Posted by Diane [Xceed] (had 1650 views)User (Old forums)MemberJuly 20, 2010 at 2:47 pmPost count: 23064
Would you provide an updated link to this sample? Thanks in advance!
Imported from legacy forums. Posted by FinallyInSeattle (had 711 views)Diane [Xceed]ModeratorOctober 15, 2010 at 1:47 pmPost count: 1353
The link for the project sample has been fixed:
Imported from legacy forums. Posted by Diane [Xceed] (had 1079 views)
- You must be logged in to reply to this topic.