BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi
How to fix this "staircase" effect? (I want all of the stacked headers to be at the same height)
code:
.xaml:
<Syncfusion:SfDataGrid x:Name="resultGrid"
MaxHeight="300"
Margin="0,3, 7, 0"
AutoGenerateColumns="False"
SelectionMode="Single"
ItemsSource="{Binding AnalysisResultRows}"
RowSelectionBrush="#E1ECFF"
LiveDataUpdateMode="AllowDataShaping"
HeaderRowHeight="40"
AllowSorting="False"
ColumnSizer="Star"
FontSize="22"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
GridValidationMode="InEdit"
GridPasteOption="None"
GridCopyOption="None"
>
</Syncfusion:SfDataGrid>
.xaml.cs (code behind):
if (null != DataContext)
{
AnalysisResultViewModel viewModel = (AnalysisResultViewModel)DataContext;
resultGrid.Columns.Add(new GridTextColumn()
{
HeaderText = "File Name",
MappingName = "FileName",
});
resultGrid.Columns.Add(new GridTextColumn()
{
HeaderText = "Filter",
MappingName = "Filter",
});
resultGrid.Columns.Add(new GridNumericColumn()
{
HeaderText = "Intensity",
MappingName = "Intensity",
});
for (int i = 0; i < viewModel.SensorNames.Count(); i++)
{
resultGrid.Columns.Add(new GridNumericColumn()
{
HeaderText = "Intensity",
MappingName = $"SensorIntensities[{i}]",
});
resultGrid.Columns.Add(new GridNumericColumn()
{
HeaderText = "Statistical Error",
MappingName = $"SensorStatisticalErrors[{i}]",
});
StackedHeaderRow shr = new StackedHeaderRow();
shr.StackedColumns.Add(new StackedColumn()
{
ChildColumns = $"SensorIntensities[{i}],SensorStatisticalErrors[{i}]",
HeaderText = viewModel.SensorNames.ElementAt(i),
});
resultGrid.StackedHeaderRows.Add(shr);
}
}
result:
Hi Shai Ben-Gigi,
Currently we are validating the reported issued from our end. We will analyze and update you with further details on or before December 7, 2022.
Regards,
Sethuramkumar Senthilkumar.
Shai Ben-Gigi,
We have checked the reported issue with the provided details. The reported
scenario is not an issue, the stacked header rows were added multiple times
based on the Iteration that’s why it showed like the shared screenshot. In the
provided code snippet, you are adding the new StackedHeaderRows for every StackedColums
that caused the reported problem. You should add all the StackedColumns
into one StackedHeaderRow shown in the below user guide documentation,
UG Link: https://help.syncfusion.com/wpf/datagrid/stacked-headers?cs-save-lang=1&cs-lang=csharp