Hi,
We use MVVM in our application, our requirement to display records in form of Tree, in child node we display data in column wise currently we showing data in four columns(Value, Avg., St.Dev, PCT) and in last coulmn "PCT" value color is generated based on its value (red circled in snapshot), we want same look and feel by using XamDataTree or any other control like in attached snapshot.
By default first node will be expanded and when user switch to other node then previous expanded node will be collapsed automatically, and expanded the the new one where user click it. Is it possible to achieve same look and feel like in showing snapshot ? Sample application is really very helpful for me.
Hi elinder,
Right now there are probably 3 controls that you could use to achieve this. The XamDataTree, the XamDataGrid and the XamGrid. I'm not sure which one would be the best choice to go with though. The XamDataGrid and XamGrid both have the ability to display columns so one of them may be able to be adjusted to look like your mock-up. Your mock-up looks almost exactly like the XamDataTree though so maybe if all you plan to have are columns in the child nodes then it's probably easier just to modify the XamDataTree node tempates to include a column format and then just stick some dummy headers above the XamDataTree.
I'll look at the options and let you know what I come up with.
Hi Rob,
Thanks for quick response, XamDataTree is the best option, because we must showing data in column wise in child node, now need to modify the XamDataTree node templates to include a column format, can you prepare a small sample application with all my functionlities that i was explained in my previous post ?
The ChildNode and Stat class structure doesn't make sense to me. If you have a collection of Stats objects in the ChildNode class, I would expect that you would want to have a 3rd level to the tree where you would expand "Days sales outstanding", for example, and you would then see your list of Stats underneath that. But when I look at your initial screenshot, I can't see how it's supposed to work that way. All of your stats are on the same level as the ChildNode. Did you change your tree requirements?
I have attached a sample which shows the Stats on a third level.
Let me know if you have any further questions on this matter.
Thank you so much for your great support with quick response
Thanks
Hi All,
Any update ?
Any body help me on this matter on urgent basis ?
Any update?
Thank you so much for your reply, i have solved my problem, but i have some more concerns about it like
The process for adding arrow images to the nodes would be pretty similar to my previous sample. It will involve retemplating the XamDataTreeNodeControl to add your images. If you look at my previous sample, in the "StatNodeStyle" style you can see that I added a StackPanel called "columns" which rendered the columns. From the DataContext for the node control you can get the underlying data item for that node and from there you can determine what kind of image to show (up arrow, down arrow or dash image). Then for child nodes you would have a separate XamDataTreeNodeControl template that shows one arrow depending on the underlying node data.
As for determining what the parent node of the clicked node is, there's no built in MVVM solution for this. If your underlying data is setup to keep track of parent nodes (the child node has a property that holds the parent node) then it is as simple as binding a view model property to the ActiveDataItem on the XamDataTree and then accessing the view model property and getting the parent from the underlying data. Other than this, you can create a Behavior<T> which attaches to the XamDataTree and then you can handle the ActiveNodeChanged event inside the behavior. This event will give you the newly activated node so you can then access the Manager property to get the ParentNode. If you add a DependencyProperty to the Behavior<T> you should be able to bind something in your view model to it.