Hi Team,
We have a very simple problem:
With a Sample data model like below
public class SampleData { public string Name { get; set; } public string Category { get; set; } public List<SampleData> ChildData { get; set; } public string LabelProperty { get; set; } }
We get a Hieraachical grid like the picture attached.
Is there any easy way to not have a header in the expanded level, and have the columns aligned and in sync? We are looking for having a multi level hierarchy and this repeated header and column misalignment is really becoming a show stopper.
Thanks
Hi,
Thank you for following up and clarifying your requirement!
It seems that there is currently an issue with attaching images to posts, so if you still need assistance after reviewing the below reply, I can suggest sharing your picture through a link.
Regarding the columns widths not being the same after resizing, that is indeed the case, even in the previously attached sample app, as the parent and child field layouts are different and the fields are as well.
One option to address this is to reuse the same field layout for the different levels, as I understand you have already tried. However, in that case hidning the child field layout’s label via the LabelLocation property approach would not be applicable, as you've already determined yourself, since the same field layout will be reused and this setting is applied on the field layout level.
Fortunately, there exist workarounds and such indeed have been discussed in multiple topics in our forum. For instance, in this thread you can find an approach suggested by Andrew Goldenbaum that hides the DataRecordPresenter via a custom style. As explained by him, for this an additional boolean property might need to be added to the data to indicate whether a record is a child or not.
For your convenience, I modified the previous sample with a similar data structure and this approach. Please, find it attached below.
Lastly, remains the built-in indentation of the different hierarchy levels. This is by design and is typically used as a visual indicator to distinguish between the levels. If, however, this is not something required in your scenario, another workaround on application-level has to be applied. It would involve modifying the Margin of the DataRecordPresenter by leveraging a custom converter. I have also included it in the modified sample, so please, check it out. Please, note that this is a custom solution, which has to be adopted after testing it against your own application specifications.
Please, check out this gif for a demo of the final look of the hierarchy and behavior on resize.
In conclusion, please, check out the referenced resources and let me know if they help.
Best regards,Bozhidara Pachilova
83400.XDGHierarchicalData1-Modified.zip
Hi Bozhidara
thanks for the reply. I think we end up creating 2 threads as the website didn't respond properly earlier today and we thought the first one didn't work. It is absolutely fine to use this one.
On your response, so setting it to hidden means all headers are hidden. We do still want to have the top level header.
We saw an answer before that this can be achieved with code behind by having separate field layout between the 2 hierarchies, however then the columns are not synced once you resize.
Regarding the misalignment -- trying to upload again below. I'm guessing they will be aligned if the square to the left of the first header is removed?
Hello,
Thank you for posting to Infragistics Community!
I believe you will find the LabelLocation Property of the FieldLayoutSettings object quite helpful on the matter. Setting its value to “Hidden” would result in the child filed layouts headers not showing.
<igWPF:FieldLayout.Settings> <igWPF:FieldLayoutSettings LabelLocation="Hidden" /> </igWPF:FieldLayout.Settings>
Regarding a misalignment, I am afraid the picture you mentioned did not get attached. Furthermore, I am not able to reproduce any misalignment in a test app I have created for the purposes of the example:
You can find the sample attached below. Please, check it out and let me know if your grid has some additional configurations that may be causing this. This information will be highly appreciated, so we can proceed with assisting you.
Lastly, I noticed this other forum thread on quite the similar topic created from another user account, however, associated with the same company. Please, note that according to our support policy, we handle a single thread/support case per question. This is for better tracking and to ensure that all your queries are addressed correctly. Let us please, continue our communication in the current thread, so that the discussion is easily traceable. Thank you for understanding.
In case there are some aspects of your question that I did not quite catch, please, elaborate further. Feel free to provide any relevant code-snippets, screenshots, or ideally, please modify the attached sample with only the minimal reproducible code and send it back to me so I can look into it.
Best regards,Bozhidara PachilovaSoftware Developer
8371.XDGHierarchicalData1.zip