I am using XamWebGrid 10.1, I am using ColumnLayout to show parent/child details, and want to be able to move columns around, when I enable it the parent level moves, but want to know if it is possible to move the child columns with it.
I was trying Grid_ColumnDropped(object sender, ColumnDroppedEventArgs e) event but not sure if there is way to move the columns in code.
Hi,
So Column moving actually is just moving columns from within the collection.
So, for your child ColumnLayouts, you would just remove the column, and insert it to the same index as the parent column. ColumnBase col = columnLayout.Columns["ParentColumnKey]);
columnLayout.Columns.Remove(col)Columnlayout.Columns.Insert(parentIndex, col);
Hope this helps,
-SteveZ
Steve,
You were close enough to point me in the right direction. Here is what I did.
private void dg_ColumnDropped(object sender, ColumnDroppedEventArgs e) { ColumnBase col = e.Column.ColumnLayout.Columns.ColumnLayouts["DetailData"].Columns[e.Column.Key]; e.Column.ColumnLayout.Columns.ColumnLayouts["DetailData"].Columns.Remove(col); e.Column.ColumnLayout.Columns.ColumnLayouts["DetailData"].Columns.Insert(e.NewIndex, col); }