Infragistics xamDataGrid bound to hierarchical data - how to notify grid of changed in second level?

走远了吗. 提交于 2019-12-06 07:40:16

Try to use ObservableCollection as collection of nodes in you tree-structure.

Please try this..It works

First of all,Create two classes like this

public class CustomerDetails1
    {
        public string Id { set; get; }
        public string Name { set; get; }
        public string Place { set; get; }
        public string Mobile { set; get; }
        public List<Level2Customer> Level2CustomerInst { get; set; }
    }

    public class Level2Customer
    {
        public string Address { set; get; }
        public string Street { set; get; }
    }

In Xaml page

<igWPF:XamDataGrid Width="767" Name ="TestDatagrid"  DataSource="{Binding CustomerList1}"   Height="403">
                                    <igWPF:XamDataGrid.FieldLayoutSettings>
                                        <igWPF:FieldLayoutSettings AutoGenerateFields="False"/>
                                    </igWPF:XamDataGrid.FieldLayoutSettings>
                                    <igWPF:XamDataGrid.ViewSettings>
                                        <igWPF:GridViewSettings UseNestedPanels="True" Orientation="Vertical"/>
                                    </igWPF:XamDataGrid.ViewSettings>
                                    <igWPF:XamDataGrid.FieldLayouts>
                                        <igWPF:FieldLayout Key="layer1">
                                            <igWPF:FieldLayout.Fields>
                                                <igWPF:Field Name="Id" Visibility="Visible"/>
                                                <igWPF:Field Name="Name" Visibility="Visible"/>
                                                <igWPF:Field Name="Place" Visibility="Visible"/>
                                                <igWPF:Field Name="Mobile" Visibility="Visible"/>
                                                <igWPF:Field Name="Level2CustomerInst" Visibility="Visible" IsExpandable="True" Label="Level2CustomerInst" IsSelected="True" IsPrimary="True" />
                                            </igWPF:FieldLayout.Fields>
                                        </igWPF:FieldLayout>
                                        <igWPF:FieldLayout Key="Level2CustomerInst"  ParentFieldName="Level2CustomerInst" ParentFieldLayoutKey="layer1">
                                            <igWPF:FieldLayout.Fields>
                                                <igWPF:Field Name="Address"  Label="Address"/>
                                                <igWPF:Field Name="Street"  Label="Street"/>                                                   
                                            </igWPF:FieldLayout.Fields>
                                        </igWPF:FieldLayout>
                                    </igWPF:XamDataGrid.FieldLayouts>

                                </igWPF:XamDataGrid>

If you want to expand the child list on load,You can try handling the InitializeRecord event and set the IsExpanded property of the Record:

  private void TestDatagrid_OnInitializeRecord(object sender, InitializeRecordEventArgs e)
    {
       e.Record.IsExpanded = true;
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!