Hello,
im using XamDataGrid hierachical through binding its DataSource to a hierachical DataSet, and provide they FieldLayout + RelationField for each FieldLayout/Table, dynamically. (I generate the grid all code-behind, no xaml. (Dynamic relations & columns.))
I dont want the relation headers "relation6" / "relation7" / ..
My problem is, i add multiple child-relations for a table - used by different rows. The grid now displays every relation for every row, even if its empty for this row. How should i provide the relations? Or Hide the relation-groups/headers? (hide relation field?)
GreetingsiA. Kits
Hi Joerg,
If I'm understanding this correctly, you just want to hide the relations that have no child records? This relations are appearing because a Field has been defined for that relation. I presume that you are using auto generated fields? You can hide these relations by using the following style:
<Style TargetType="{x:Type igWPF:ExpandableFieldRecordPresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.HasChildren}" Value="False"> <Setter Property="Height" Value="0"/> </DataTrigger> </Style.Triggers></Style>
Those relations that you see are called ExpandableFieldRecordPresenters. When there is children data you would normally be able to expand the relation and see the child data but if there are no children it does not hide the relation itself. You can do this with the above trigger. If there are no children in the ExpandableFielRecordPresenter then it will set the height to 0. We set the height to 0 because you can't actually set the Visibility to Collapsed. If you do, the record space will still be shown.
Hi Rob,
thanks for your fast response.
i dont want the ExpandableFieldRecordPresenters "relation6" / "relation7".. displayed at all. Also not for rows which has children.
I want it like you can see in the first hierachical level of my screenshot - the expansionindicator directly before the row, without any additional header "RelationName".
PS: I dont use auto generated fields. I generate them myself. I use KeyMatchingEnforced (and layout.Key = table.TableName).