hi
i have a XamDataGrid, whose FieldLayout i have to set in code behind.
the Layout has came from some other objects as property.
like
{
grid.FieldLayouts.Add(newLayout);
grid.DefaultFieldLayout = newLayout;
grid.FieldLayouts.Remove(oldLayout);
}
SetGridLayout(
this.DetailGrid, dlg.UnSelectedFieldLayout);
Alex,
Thanks for your sample. What we really looking for is to use a Fields Layout between two grids. We know if we create a field Layout in a resource we can reuse it but our case is different.
We have a selected and un selected grid and want to provide the same layout for them so what we do is
Allow user to set the FieldLayout for the selected grid , now we do something like
XamDataGrid selectedgrid
XamDataGrid unselectedgrid
FieldLayout selectedgridLayout = selectedgrid.DefaultFieldLayout;
unselectedgrid.DefaultFieldLayout = selectedgridLayout;
we get the error mentioned (Can not copy field layout)
We do understand that if FieldLayout is attached to one grid we can not reuse it for another grid what we are looking for is a method
to copy FieldLayout from currently displayed grid
Any suggestions are apppretiated
Hi Alex,
thanx gor quick reply
give me sometime to check it out.
Laki
Laki,
I am attaching a sample that I made trying to reproduce this problem.
Let me know what is different in your scenario.
Alex
the error i gor is "Fieldlayout can not be move to another DataPresenterBase.
yes i do bind the data source of Grid. the line you mentioned, contains the Layout from another page/object which i want to apply for my grid in Main Page.
laki
Please specify what exactly is the error/ exception (NullReference,ArgumentOutOfRangeException,etc.)
Also note that you would have to rebind the grid in order to change the layout.
I am also not sure what this line does:
FieldLayout gridFieldLayout = e.OriginalSource as FieldLayout; // contain the Layout of Grid from Picker Page