Hi,
I have a XamDataGrid where I have specified the DataSource. Also, in the FieldLayout I am adding an additional unbound field, but this always comes up as the first column in the grid. How can I change the index of thie unbound field? Can I make it as the last column? Or specify any other index?
Hello Arpita,
I have been looking into your post and I have defined a field layout which contains an unbound field and this field appears exactly in the position in the defined layout. I am attaching a sample application(DataGridUnboundFieldPosition.zup) that shows it.
Let me know if I am missing something.
If I already know all the column headers then what you have provided works fine but that does not help me here. I have the datagrid defined as below -
<igDP:XamDataGrid DataSource="{Binding MySource}" AutoFit="True">
<igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:UnboundField Name="Details"> <igDP:UnboundField.Settings> <igDP:FieldSettings AllowResize="False" AllowGroupBy="False" AllowRecordFiltering="False" AllowSummaries="False" LabelTextAlignment="Center" CellValuePresenterStyle="{StaticResource SomeStyle}"/> </igDP:UnboundField.Settings> </igDP:UnboundField> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
I want this unbound field in a specific index or at least in the last index.
Thank you for your feedback. Now I can see what exactly is your scenario. In order to change the position of the added unbound field you can handle the ‘FieldLayoutInitialized’ event of the XamDataGrid and move the field manually like e.g. :
private void xamDataGrid1_FieldLayoutInitialized(object sender, Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs e)
{
UnboundField unboundField = this.xamDataGrid1.FieldLayouts[0].Fields[0] as UnboundField;
this.xamDataGrid1.FieldLayouts[0].Fields.RemoveAt(0);
this.xamDataGrid1.FieldLayouts[0].Fields.Insert(2, unboundField);
}
Let me know, if you need any further assistance on this matter.