Hello,
I have a multilevel hierarchical XamDataGrid. I wan to Indent parent and child in only first column of every child record.
For this, I tried to apply CellValuePresenter style to first column of child record's FieldLayout with Left Margin 20.
It works fine for first child record but for second child level onwards also it applies margin 20 to first field.
Whereas for second child now left margin should be 40 and third level child should have left margin of 60 and so on.
I thought of achieving this by applying cellvaluepresenter to every field layout from code behind by multiplying left margin by nesting depth of current record or by adding 20 to parent record's margin. Is this possible?
How do I achieve this? or is there any work around. Other solutions are not working as expected for me.
Thanks,
Priya
Hello Priya,
In the XamDataGrid.FieldLayoutSettings, there is a property named AutoFitMode. If you set this to ExtendLastField, I believe you will re-align the columns properly.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewDeveloper Support Engineer IInfragistics Inc.www.infragistics.com/support
Hey Andrew,
With AutoFit = true, I get below layout:
Only child with maximum nesting depth is properly aligned with root.
What should I change to solve this?
Hello Andrew,
The solution you provided works fine.
But then how to make it work with AutoFit = true?
I believe I understand better now. My understanding is now that you want to indent the first column of each child row further and further based on the row index. I have found a different forum post that Styles the CellValuePresenter and uses a converter to set the margin based on the NestingDepth property of its DataContext. I believe that this NestingDepth property may be the property you are looking for, as it returns an integer value based on its nested level. The link to the forum thread is below:
Link: http://ko.infragistics.com/community/forums/p/16974/213729.aspx#213729.
The sample given on the forum thread uses our 9.2 WPF product, so I converted the project over to 14.2 for your convenience. That project is attached to this post.
I hope this helps you. Please let me know if you have any other questions or concerns on this matter.
Sorry about causing the confusion.
My main goal is to indent paren-child records in XamDataGrid. Please refer my other post to understand this:
http://ko.infragistics.com/community/forums/p/93020/460297.aspx#460297
I have applied solution given by Yanko & Krasimir. Now I get XamDataGrid with no identation at all in parent-child rows. Thus I am trying to put left margin to child row's first column based on nesting depth to achieve desired output.
Thank,