I am trying to display the collection properties such as string[] in Fieldchooser. Its being displayed in datagrid but not in FieldChooser. Please let me know what should I do ?
Hello Ramesh,
I have been looking into the issue you have described in your last post and I have modified the previous sample for you to test.
In order to achieve the behavior you have described in regards to hiding the empty child collections, an approach I can suggest you is to handle the RecordExpanded event of the XamDataGrid as I have done in the sample. Inside it we check if the currently expanded record is a DataRecord and we iterate through its ChildRecords which represent the collections. If any of these collections has any child records, we set it's Visibility property to Visible, otherwise we set it to Collapsed.
If you require any further assistance on this matter, please do not hesitate to ask.
Hi,
Is it possible to hide the name of the list property or an array of strings property from appearing in XamDatagrid if it has no elements?
Thank you for your feedback.
If the DataItems of your DataRecords contain a List property or an array of strings property as you have described, the XamDataGrid treats them as child collections for every DataItem and a new FieldLayout is created for both of these collections.
The reason for the issue you have described is because the FieldGroupSelector gets updated with the child collections' Fields when the child records have been accessed at least once. This could be achieved by simply expanding a DataRecord or accessing the child records in code behind. After that, by using the FieldGroupSelector in the FieldChooser you should be able to select a FieldLayout and afterwards all its respective Fields will be visualized in the FieldChooser.
I wanted to display all the columns in the field chooser irrespective of the collection has data or not. In my data I observed that string[], List columns are not displayed in field chooser. That's why I specified collection properties in generic.
I have been looking further into your issue and would you please provide me with more detailed information in regards to the functionality you would like to achieve as a whole and what you mean by saying collection properties?
In the sample you have provided, you have created a property that returns an extended List of DataItems with no fields and properties. The XamDataGrid visualizes the expanding indicator by default for every record since there is a collection property for the DataItems of the parent FieldLayout. If you add at least one TestInfo item to the child collection for each record, then you should be able to see a dropdown in the FieldChooser allowing you to choose between the fields for both the parent and the child layout of the XamDataGrid.
Looking forward to hearing from you.