We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Summary row is not updating when i add/remove a new row

My dataGrid has a ObservableCollection as data source.

When i add a new item into collection, the total values in summary row does not updated!
There is screenshot in attach file.


My sfDataGrid :
<syncfusion:SfDataGrid Grid.Row="1"
                               x:Name="MainSfDataGrid"
                               ItemsSource="{Binding Path=TemporaryCollection,Mode=TwoWay}"
                               AllowGrouping="False" AllowResizingColumns="True" AllowRowHoverHighlighting="True"
                               AllowSelectionOnPointerPressed="True"
                               BorderBrush="{DynamicResource LightBlueAccentBrush}" AutoGenerateColumns="False"
                               RowHoverHighlightingBrush="{StaticResource LightOverlayBlueAccentBrush}"
                               Background="Transparent"
                               SelectedItem="{Binding Path=SelectedItem,Mode=TwoWay}">
            <syncfusion:SfDataGrid.Resources>
                <Style TargetType="syncfusion:GridHeaderCellControl">
                    <Setter Property="Foreground" Value="White" />
                    <Setter Property="Background" Value="{DynamicResource LightBlueAccentBrush}" />
                </Style>
            </syncfusion:SfDataGrid.Resources>
            <syncfusion:SfDataGrid.Columns>
                <syncfusion:GridNumericColumn HeaderText="№" MappingName="RowNumber" NumberDecimalDigits="0"
                                              ColumnSizer="Auto" />
                <syncfusion:GridNumericColumn HeaderText="Article" MappingName="Article" NumberDecimalDigits="0"
                                              ColumnSizer="Auto" />
                <syncfusion:GridTextColumn HeaderText="Title" MappingName="Title" ColumnSizer="Star" />
                <syncfusion:GridTextColumn HeaderText="Description" MappingName="Description" ColumnSizer="Star" />
                <syncfusion:GridNumericColumn HeaderText="Quantity" MappingName="Quantity" NumberDecimalDigits="2"
                                              ColumnSizer="Auto" />
                <syncfusion:GridNumericColumn HeaderText="Price" MappingName="Price" NumberDecimalDigits="2"
                                              ColumnSizer="Auto" />
                <syncfusion:GridNumericColumn HeaderText="Summ" MappingName="Sum" NumberDecimalDigits="2"
                                              ColumnSizer="Auto" />
            </syncfusion:SfDataGrid.Columns>
            <syncfusion:SfDataGrid.TableSummaryRows>
                <syncfusion:GridTableSummaryRow  Title="Summary: {TotalSum} , {TotalQuantity} names." ShowSummaryInRow="True">
                    <syncfusion:GridTableSummaryRow.SummaryColumns>
                        <syncfusion:GridSummaryColumn Name="TotalSum"
                                                          Format="'{Sum:c}'"
                                                          MappingName="Sum"
                                                          SummaryType="DoubleAggregate" />
                        <syncfusion:GridSummaryColumn Name="TotalQuantity"
                                                          MappingName="RowNumber"
                                                          Format="'{Count:d}'"
                                                          SummaryType="CountAggregate" />
                    </syncfusion:GridTableSummaryRow.SummaryColumns>
                </syncfusion:GridTableSummaryRow>
            </syncfusion:SfDataGrid.TableSummaryRows>
        </syncfusion:SfDataGrid>


Attachment: Screenshot_4_aacbd77a.rar

3 Replies

SR Sivakumar R Syncfusion Team January 5, 2016 03:27 PM UTC

Hi Mikhail,

Based on the code snippet provides, set SfDataGrid.LiveDataUpdateMode property value to AllowSummaryUpdate or AllowDataShaping.
https://help.syncfusion.com/wpf/sfdatagrid/data-manipulation

Please let us know if you have any questions.

Thanks,
Sivakumar


MI Mikhail January 6, 2016 08:02 AM UTC

Thanks for your advice, I set the property SfDataGrid.LiveDataUpdateMode to AllowSummaryUpdate , and now the summary row works correct!


SP Sowndaiyan Paulpandi Syncfusion Team January 7, 2016 03:56 AM UTC

Hi Mikhail,

Thanks for the update.


Please let us know if you need further assistance.
Regards,
Sowndaiyan

Loader.
Up arrow icon