Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
XamDataGrid SummaryDefinitions Calculator Sum is not working for unbound field
posted

Hi,

I have an unbound field that I want to show the sum of it in the footer, but it shows it as 0.00.

Unbound Field:


<dataPresenter:UnboundField x:Name="txt_amt" Name="amt" Label="" DataType="{x:Type system:Int32}">
<dataPresenter:Field.Settings>
<dataPresenter:FieldSettings AllowSummaries="True">
<dataPresenter:FieldSettings.CellValuePresenterStyle>
<Style TargetType="{x:Type dataPresenter:CellValuePresenter}" BasedOn="{StaticResource {x:Type dataPresenter:CellValuePresenter}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<TextBoxText="{Binding DataItem.amt, StringFormat={}{0:N2}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</dataPresenter:FieldSettings.CellValuePresenterStyle>
</dataPresenter:FieldSettings>
</dataPresenter:Field.Settings>
</dataPresenter:UnboundField>

And in definition:

<dataPresenter:FieldLayout.SummaryDefinitions>
<dataPresenter:SummaryDefinition SourceFieldName="amt" Calculator="Sum" StringFormat="{}{0:N2}"/>
</dataPresenter:FieldLayout.SummaryDefinitions>

Thanks