Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
FieldLayout can not be moved to another DataPresenterBase
posted

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

private void SetGridLayout(XamDataGrid grid, FieldLayout newLayout)

{

 

 

if ((null != grid) && (null != newLayout))

{

 

 

FieldLayout oldLayout = grid.DefaultFieldLayout;

 

 

if (oldLayout != newLayout)

{

grid.FieldLayouts.Add(newLayout);

grid.DefaultFieldLayout = newLayout;

 

 

if (null != oldLayout)

grid.FieldLayouts.Remove(oldLayout);

}

}

}

 

 

void ShowPicker_PickerShowed(object sender, RoutedEventArgs e)

{

 

 

PickerDialog dlg = e.OriginalSource as PickerDialog;

SetGridLayout(

this.DetailGrid, dlg.UnSelectedFieldLayout);

Parents Reply Children