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);
hi Alex,
i don't have sample project but scenario is like.
from my main page i open an picker from which i select the dat which has to be displayed in my Grid present on Main Page.
in picker i have grid whose FieldLayOut is dynamic and changeble.
so the present FieldLayOut from Picker i want to apply the same to my Grid on Main Page.
for that i write one eventhandler in my Picker Page, which return the FieldLayout , which i want to apply to the grid on my Main Page.
i try to do this in follwoing code piece.
private
void SetGridLayout(XamDataGrid grid, FieldLayout newLayout)
if ((null != grid) && (null != newLayout))
FieldLayout oldLayout = grid.DefaultFieldLayout;
if (oldLayout != newLayout)
grid.FieldLayouts.Add(newLayout); ///add the Layout Came from Picker page
<summary>
calls the method to set layout of XamDataGrid.
</summary>
<param name="sender"></param>
<param name="e"></param>
FieldLayout gridFieldLayout = e.OriginalSource as FieldLayout; // contain the Layout of Grid from Picker Page
this.DetailGrid, gridFieldLayout);
Laki,
Give us more detailed information on the error?
If you have a sample project that reproduces the problem, please attach it to your next post.
i got error on line
grid.FieldLayouts.Add(newLayout); in above code of piece from Method
SetGridLayout(....)
thanx
Laki
Hello,
Could you please point out where the problem is?