I used a UltraTree control in a Winforms project where I had a 'grid row' with the columns that I need shown as a node in the tree which looked similar to a grid with different headers/cells in each row. Now I am trying to re-create something similar with WPF and I am not certain which control I need to use - xamDataGrid or xamTree (if the latter even has support for grid nodes?). Here is the structure that I am looking to create:
Node1
|_ ColumnA | ColumnB | ColumnC
CellA | CellB | CellC
Node2
|_ ColumnD | ColumnE | ColumnF
CellD | CellE | CellF
Can similar structure be accomplished with xamDataGrid hierarchical grid? I will be fine with dropping Nodes and just showing grid rows too. Thanks!
Hello Andre,
Thank you for your post. I have been looking into it and I can suggest you use the XamDataGrid control. In the Samples Browser under xamDataGrid / Data / Hierarchical Data Binding section there is a sample showing how to show the data. Also I can say that in our next version (15.1) there will be a TreeView for the XamDataGrid as well. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.
Stefan, thanks for prompt response. I checked the samples and the difference with my requirements is that the child band columns under each top level node (in red) are the same but I need them to be completely different - each top level node has its own set of child band columns. Is that kind of binding supported? Thanks.
I have created a sample project for you with the functionality you want. Basically I created different FieldLayouts for the child records. I also handled the XamDataGrid's AssignFieldLayoutToItem event and in the handler I apply different layouts to different records. Please note that in my scenario all child Records are the same, just the Fields that are shown are different and this is why the layouts should be defined. If the child records are from different types all these will happen automatically. Please let me know if this helps you or you have further questions on this matter. Looking forward for your reply.
Stefan, thanks for the sample. Another requirement that I have that I failed to mention is to have dropdown column headers in the grid. In other words, my grid will always contain exactly one row which will contain values and each column header will be a combo box with a value selected. Columns will be added 'on-the-fly' depending on user selection - so this has to be a very dynamic control that will bind to a frequently refreshed collection/data table. Hence, I cannot list FieldLayout Fields as I don't really know how the data table will look like ahead of user selection. Does it make sense? Or else, if I do make it have a static structure, I will have to constantly hide/show certain fields but I'd prefer to rebind grid to a new structure after every selection. It should look something like the following:
|_ ColumnA |v| ColumnB |v| ColumnC|v|...
|_ ColumnD |v| ColumnE |v| ColumnF |v|...
How easy is it to embed a combo-box control into a grid column header? Or is it simpler to just hide the column headers alltogether and have two rows in the grid - one with combo-boxes and one with text boxes and style the first row to look like a header? Can you please provide an example of a 'combo box header' if this is doable? (I need to bind it to an ViewModel side collection obviously) Thanks!
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Thanks for your help, I decided to go a different route.