is the Visibility attribute of the Field element the only way to control visibility of a of a column. My object whose collection is used as DataContext has 20 properties yet I want to display only 5 of them in a grid. I don't want to define 20 field elements and set the visiblity of 15 of them to false.
I'm trying to remember how the auto amtchup logic works for choosing the "correct" field layout. I would like to think that if you define fields for a subset of the exposed properties, it would match things up for you. In other words, if you defined just two fields (FullName and Phone) to represent a list of contact objects, wouldn't that work just fine?
If not, you can make your desired field layout (subset of fields) and then programmatically assign that layout to the record in the AssigningFieldLayoutToItem event of the grid.
This is a quote from the documentation;
A FieldLayout defines the Fields (columns) contained in a particular DataRecord. When a DataRecord is created, the FieldLayouts collection is searched for an existing FieldLayout whose Fields match the DataItem's properties. If a FieldLayout is found, it is associated with the DataRecord; if it is not found, a new FieldLayout is created. When a new FieldLayout is created, the FieldLayoutInitializing and FieldLayoutInitialized events are raised.
Whis means that if a fieldLayout for a DataRecord is not found and new one is created and the Field Layout events are generated. Does it mean that I would have to set the Visibility=false in the FieldLayoutInitializing handler to prevent it from displaying?