First, I would say XamTreeGrid is a fantastic control ; this a common UI need in our application. We achieved all we had expected except one thing : resizing row height based on a condition.
We have a simple case that says :
If Node has children, Row Heigtht is 25 ; if not Row Height is 50. I tried everything, redefine CellValuePresenterStyle, DataRecordPresenterStyle, DataRecordCellAreaStyle, nothing works. We cannot use DataRecordSizingMode, cause the sizing does not depend on text Content (Wrapping) but on a cell template (a grid with 3 rows).
If you have an idea, I take it. Thanks
Stéphane
Hello Stéphane,
Thank you for your post!
I have been looking into it and want to thank you for the feedback provided on our controls. I am glad that the XamTreeGrid has met most of your expectations.
Regarding your question - you can create a style for the TreeCellValuePresenter. This is the present for the tree cells. In the style you can create a Setter for the Height property and assign 50 as value.
Then you create a Trigger in the style and check if the ExpansionIndicatorVisibility property is set to Visible. When the ExpansionIndicator next to the cell is visible it means that the node has children.
I have created a small sample application for you to show you the above mentioned functionality. Please find the attachment and feel free to let me know if you have any further questions on this matter.
Thanks for your quick answer.
I tried as you did:
<Style TargetType="{x:Type igDP:TreeCellValuePresenter}">
<Setter Property="Height" Value="40"/>
<Style.Triggers>
<Trigger Property="ExpansionIndicatorVisibility" Value="Visible">
<Setter Property="Height" Value="20">Setter>
Trigger>
Style.Triggers>
Style>
The thing is, the height is bigger when no children, that's ok. But the height of nodes with children does not fit (20).
Actually, cells have 20 for height but the record not (it's bigger).
See attachment. The selected cell seems 20 for height, but the record seems 30.
I have been looking into your latest post and I was not able to reproduce the issue that you have mentioned, using the sample application from my previous post. I have created a screenshot for you to see the behavior on my side. On the screenshot - a record with children and one without children are selected and the third one is hovered.
Would you please provide the sample application with the functionality you are using, so it reproduces the issue? This way I would be able to further investigate this matter for you and provide you with further information.
Looking forward to hearing from you.
Attaching the screenshot.
Thank you for the feedback. I am glad, that you have found a solution to your issue.
Hi,
I figured out what was wrong in my case.
Actually I need to create dynamic fields and I use a custom control template which contains a grid with 3 rows ; I didn't manage the visibility of this grid (visible only for nodes with no children), but the height of the grid overrides the height set by the trigger.
Thanks for you great support.