As it was suggested to me once
, I use partial class with a method that changes column visibility. E. g.:
public partial class MyUI : UIRoot
public void CollapseColumns(int columns)
foreach (int i in columns)
dataGrid1.Columns[i].Visibility = Visibility.Collapsed;
But column header doesn't collapse (while the rest of the column collapses as expected). I suspect it's a bug, because, when I set Visibility to Collapsed in XAML, everything works as expected and headers collapse.