Guys, after calling XamDataGrid.LoadCustomizations(string) with a valid grid layout string, I get the the FieldLayout successfully created.
If I query the grid for visible fields, I get a list that includes all the fields even though there are some fields with visibility set to collapsed in the original field layout string. Also, when grid is rendered, I see only those fields whose visibility is not collapsed.
I am querying visible fields as follows:
public static StringCollection GetVisibleFieldNames(this XamDataGrid grid)
{
if (grid.FieldLayouts.Count == 0) return null;
var f1 = grid.FieldLayouts[0];
return new StringCollection( f1.Fields.Where(f => f.Visibility == Visibility.Visible).Select(f => f.Name));
}
Any hints on what I am missing?
Nevermind. Problem is me.
Related question though:
After calling XamDataGrid.LoadCustomizations(string), when does the grid actually create these fields? I am noticing that if I query for visible fields immediately after calling LoadCustomizations but with grid not yet rendered, I got no field layouts. Is there a way to determine if grid successfully loaded layout and also get a list of visible fields before grid is rendered?