Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1235
Multiple relations for one table/layout
posted

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?)

Greetings
iA. Kits

Parents
  • 34510
    Offline posted

    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.

Reply Children