I try to persist changed column positions. We use our own ui to move columns and save it in a file similar to this:
{
"Column1": 0,
"Column2": 2,
"Column3": 1
}
No i have two problems, i'm not sure if i'm using it wrong or there's some bug in the grid.
First: When Changing Column Positions i use MoveColumn
. This moves the column in the grid but doesn't update the indices:
auto p1 = this->DataGrid->Columns->Items[1];
auto p2 = this->DataGrid->Columns->Items[5];
this->DataGrid->MoveColumn(1, 5);
ShowMessage(p1->Index);
The ShowMessage prints "1". In my Opinion MoveColumn
should print 5 as it is the new Index of the column.
Changing the Index of two columns on the other hand has no effect on the Grids visual presentation:
auto p1 = this->DataGrid->Columns->Items[1];
auto p2 = this->DataGrid->Columns->Items[5];
int a = p1->Index;
int b = p2->Index;
p1->Index = b;
p2->Index = a;
With this code i expected that the two columns are changed in grid visual presentation but it's not.
So i don't really know how to load my column positions?!