首先是我的结构
第1层&gt; <Objects>
第2层 - &gt;每个Object
内部都有Objects
的另一个集合
期望的结果:
我成功折叠了第1层上不需要的字段。
但是,当您单击展开器图标以从第1层查看所选对象上的第二层时,您会看到从该对象动态生成的所有字段。
问题:如何隐藏第2层的字段
<igWPF:XamDataGrid Theme="IGTheme" DataSource="{Binding layer1Collection}">
<igWPF:XamDataGrid.FieldLayouts>
<igWPF:FieldLayout>
<igWPF:FieldLayout.Fields>
<igWPF:Field Name="val1" Visibility="Collapsed"/>
<igWPF:Field Name="val2" Visibility="Collapsed"/>
<igWPF:Field Name="val3" Visibility="Collapsed"/>
<igWPF:Field Name="val4" Visibility="Collapsed"/>
<igWPF:Field Name="val5" Visibility="Collapsed"/>
<igWPF:Field Name="val6" Visibility="Collapsed"/>
<igWPF:Field Name="val7" Visibility="Collapsed"/>
<igWPF:Field Name="val8" Visibility="Visible"/>
<igWPF:Field Name="val9" Visibility="Visible"/>
<!-- This is where the second layer is-->
<igWPF:Field Name="val10" Visibility="Visible" IsExpandable="True" Label="Details" IsSelected="True" IsPrimary="True" />
</igWPF:FieldLayout.Fields>
</igWPF:FieldLayout>
</igWPF:XamDataGrid.FieldLayouts>
</igWPF:XamDataGrid>
答案 0 :(得分:2)
为了掩盖子网格,你必须创建第二个字段布局并将它们绑在一起......就像这样......
<igWPF:XamDataGrid.FieldLayouts>
<igWPF:FieldLayout Key="layer1">
<igWPF:FieldLayout.Fields>
<igWPF:Field Name="val1" Visibility="Collapsed"/>
<igWPF:Field Name="val2" Visibility="Collapsed"/>
<igWPF:Field Name="val3" Visibility="Collapsed"/>
<igWPF:Field Name="val4" Visibility="Collapsed"/>
<igWPF:Field Name="val5" Visibility="Collapsed"/>
<igWPF:Field Name="val6" Visibility="Collapsed"/>
<igWPF:Field Name="val7" Visibility="Collapsed"/>
<igWPF:Field Name="val8" Visibility="Visible"/>
<igWPF:Field Name="val9" Visibility="Visible"/>
<!-- This is where the second layer is-->
<igWPF:Field Name="details" Visibility="Visible" IsExpandable="True" Label="Details" IsSelected="True" IsPrimary="True" />
</igWPF:FieldLayout.Fields>
</igWPF:FieldLayout>
<igWPF:FieldLayout Key="Detail" ParentFieldName="details" ParentFieldLayoutKey="layer1">
<igWPF:FieldLayout.Fields>
<igWPF:Field Name="L2val1" Label="L2val"/>
<igWPF:Field Name="L2val2" Label="L2val"/>
<igWPF:Field Name="L2val3" Label="L2val"/>
<igWPF:Field Name="L2val4" Label="L2val"/>
<igWPF:Field Name="L2val" Visibility="Collapsed"/>
</igWPF:FieldLayout.Fields>
</igWPF:FieldLayout>
</igWPF:XamDataGrid.FieldLayouts>