I can successfully modify an existing Stacked Header column.
However if I add a new Stacked Header column in code, the changes are not visible.
eg:
View Model - initialise GridData property:
List<object> data = new List<object>();
data.Add(new TestDataRow()
{
HowMany = 2,
Name = "Chickens",
When = new DateTime(2014, 4, 16)
});
data.Add(new TestDataRow()
{
HowMany = 5,
Name = "Ducks",
When = new DateTime(2015, 3, 12)
});
GridData = new ObservableCollection<object>(data);
View - sfDataGrid:
<syncfusion:SfDataGrid x:Name="DataGrid"
Grid.Column="0" Grid.Row="0" ItemsSource="{Binding GridData}"
AutoGenerateColumns="True" AllowResizingColumns="True"
AllowEditing="False"
SelectionUnit="Row" IsEnabled="{Binding IsNotLoading}">
<syncfusion:SfDataGrid.StackedHeaderRows>
<syncfusion:StackedHeaderRow>
<syncfusion:StackedHeaderRow.StackedColumns>
<syncfusion:StackedColumn HeaderText="ONE" ChildColumns="Name"/>
</syncfusion:StackedHeaderRow.StackedColumns>
</syncfusion:StackedHeaderRow>
</syncfusion:SfDataGrid.StackedHeaderRows>
</syncfusion:SfDataGrid>
Code-behind - modify stacked header (click, on a test button):
var childColToAdd = new StackedColumn();
this.DataGrid.StackedHeaderRows[0].StackedColumns.Add(childColToAdd);
var childCol = this.DataGrid.StackedHeaderRows[0].StackedColumns[0].ChildColumns;
// modify first
this.DataGrid.StackedHeaderRows[0].StackedColumns[0].ChildColumns = childCol + ",When";
// modify second - added above - this does not work
this.DataGrid.StackedHeaderRows[0].StackedColumns[1].ChildColumns = "qty";
The first modification does work - the second does not - BUT if I click on the qty column, in the middle, it changes the sort order - correctly. If I then click above the text "qty" it does not change the sort order, as if the stacked column has been added but can't be seen.