This code worked in the previous version of the toolset, ie. before 11.2 but doesn't seem to work now.
Dim newPosition As integer = 3
ProductsDataGrid.DefaultFieldLayout.Fields.Move(ProductsDataGrid.DefaultFieldLayout.Fields("base_rate").Index, newPosition)
I fire the code above on a button click as a test.
The columns stay in their current position.
That worked perfectly, thanks!
Hello ralexander,
I am just checking if my last reply was helpful for you.
If you require any further assistance please do not hesitate to ask.
I have been looking into you issue and the use of the method Move is not appropriate because it is associated with the items of the fields’ collection and they cannot determine the order in which the fields will be positioned in the XamDataGrid. You can look through the following link about the ‘ActualPosition’ property :
http://help.infragistics.com/NetAdvantage/WPF/2011.2/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v11.2~Infragistics.Windows.DataPresenter.Field~ActualPosition.html
It is recommended when you would like to set a new position of a field to set positions for all fields or at least for the field which position will be taken like:
private void button1_Click_1(object sender, RoutedEventArgs e)
{
xamDataGrid1.FieldLayouts[0].Fields["Model"].ActualPosition = new FieldPosition(2, 0, 1, 1);
xamDataGrid1.FieldLayouts[0].Fields["BasePrice"].ActualPosition = new FieldPosition(1, 0, 1, 1);
xamDataGrid1.FieldLayouts[0].EnsureUniqueFieldPositions();
}
If you have any other questions feel free to ask.