I want to bind my DataGrid to a data source that has some simple properties and an object. The second level collection is located in this inner object. How can I define this field in the top level grid to make xamDataGrid understand that this is the collection the second level grid will be bound to?
This property is named Sections held by the object WellDesign. The collection Sections is a BindingList. xamDataGrid tells me it is a collection, but that is all, when I run this view
<ig:XamDataGrid.FieldLayouts>
<ig:FieldLayout x:Name="designGrid" Tag="Sections" Settings="{StaticResource ReadWriteGridTwoHeaderRows}">
<ig:FieldLayout.Fields>
<ig:UnboundField Binding="{Binding WellDesign.Sections}" BindingMode="OneWay" Label="Sections" Column="1" Row="1" />
<ig:Field Name="CaseDesignId" Label="CaseDesignId" Column="2" Row="1"/>
<ig:Field Name="WellDesignId" Label="WellDesignId" Column="3" Row="1"/>
<ig:UnboundField Binding="{Binding WellDesign.DesignName}" BindingMode="OneWay" Label="Design" Column="4" Row="1" />
</ig:FieldLayout.Fields>
</ig:FieldLayout>
<ig:FieldLayout x:Name="sectionGrid" Settings="{StaticResource ReadWriteGridTwoHeaderRows}">
<ig:Field Name="SectionId" Column="0" Row="1" Label="Id" Settings="{StaticResource ReadOnlyTextFieldSettings}" />
<ig:Field Name="Name" Label="Name" Column="1" Row="1" Settings="{StaticResource ReadOnlyTextFieldSettings}" />
Hello,
It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post and I suggest you see this forum thread:
http://es.infragistics.com/community/forums/t/30817.aspx
where it is explained how to define the FieldLayouts, when you have hierarchical data.
Feel free to write me if you have further questions.
My case is a bit different from what is discussed in the forum tread.
Top level is represented by an object, call it A. One of the properties in object A is another object, call if B. The collection I want to display on the next level is a property in object B. I have entered a field in the top level grid field layout for this nested grid. When the grid is displayed it displays (collection) for this field, but does not use my nested field layout.
I guess the problem is that my collection is in object B, but the grid usually will find the collection in object A.
Regards
Arnvid
I have been looking into your post, but it seems like that I am missing something in your scenario, so if this is still an issue for you, could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
Isolated sample enclosed. I want to address two issues:
1. Show me how to expand the Owners collection located in ThisCar object. I expect the datagrid to pick up the second FieldLayout, but it does not.
2. Show me how I can bind a DataItem property to the Label property for a Field/UnboundField entry.
See XAML code for first FieldLayout for the DataGrid.
Hello Arnvid,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Thank you. Your hint helped me a lot. But in my application I had to apply the AssigningFieldLayoutToItem event also to fix this issue completely,
I have been looking into your sample and I modified it so now it has the functionality you want. Basically I handled XamDataGrid’s FieldLayoutInitialized and set the Field’s DataType to ObservableCollection<Owner>. Also I can say that you are not able to bind the Label Property of a Field through the DataContext, because there it is null.
Hope this helps you.