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
360
XamDatagrid allows adding new Row, but not in empty sub-collections
posted

I have a XamDataGrid (12.2 WPF) and AllowAddNew="True" which works fine. Now my DataItems have a sub-collection that can be shown and expanded by clicking on the small symbol left to the rows. Perfect. I can also add new items to this sub-collection but only as long as there is already at least one element in it.

If there is no element in the subcollection, clicking on the "open-and-show-sub-collection" icon makes this icon just disappearing - no empty list and no AddNewElement-Row is shown!

How can i allow my customers to add new elements in an empty sub-collection??

<igWPF:XamDataGrid DataSource="{Binding ...}">
    <igWPF:XamDataGrid.FieldLayoutSettings>
        <igWPF:FieldLayoutSettings AutoGenerateFields="False" AllowAddNew="True"/>
    </igWPF:XamDataGrid.FieldLayoutSettings>

    <igWPF:XamDataGrid.FieldLayouts>
        <igWPF:FieldLayout>
            <igWPF:FieldLayout.Fields >
                <igWPF:Field Name="Title"/>
                ...
                <igWPF:Field Name="CollectionOfSubitems"/>
            </igWPF:FieldLayout.Fields>
        </igWPF:FieldLayout>
        <igWPF:FieldLayout Key="TypeOfSubitems">
            <igWPF:FieldLayout.Fields >
                <igWPF:Field Name="Id" Visibility="Collapsed"/>
                <igWPF:Field Name="Title" />
                ...
            </igWPF:FieldLayout.Fields>
        </igWPF:FieldLayout>
    </igWPF:XamDataGrid.FieldLayouts>
</igWPF:XamDataGrid>

I can add new elements to the collection. I cannot add elements of type TypeOfSubitems to the CollectionOfSubitems as long as this CollectionOfSubitems is empty!