I have Xamgrid with a summary row. For one of the column summaries (not all), I need to bold it depending on a particular external value. In other words I need to evaluate the value of the summary cell & compare it to another value and display it bold if they match. Below is the summary definitions.
Thanks,
<
igDP:FieldLayout.SummaryDefinitions>
<igDP:SummaryDefinition Key="totAmts" SourceFieldName="Amts" Calculator="Sum"
StringFormat="{Binding Source={x:Static inf:FormatStrings.Summaryformat}}">
</igDP:SummaryDefinition>
<igDP:SummaryDefinition Key="totalacrued" SourceFieldName="acrued" Calculator="Sum"
StringFormat="{Binding Source={x:Static inf:FormatStrings.Summaryformat}}" TextBlock.TextAlignment="Right"></igDP:SummaryDefinition
>
<igDP:SummaryDefinition Key="totNetAmts" SourceFieldName="NetAmts" Calculator="Sum"
StringFormat="{Binding Source={x:Static inf:FormatStrings.Summaryformat}}" TextBlock.TextAlignment="Right"
Take a look at this forum thread. It shows how to resolve this issue using MultiValueConverter.
I hope this helps.
Thanks Vlad for the response. Your solution works great if you want to bold the whole summary row. I need to bold a specific summary cell. I have 3 summary columns and I would like to apply this styling to a one particular summary column or summary cell without affecting other totals. For example, I have the below summary definition field, and want to apply the style only to this field. I tried to use datatriggers but can't figure a way to reference the particular summary fieldname.
<igDP:SummaryDefinition Key="totNetAmts" SourceFieldName="NetAmts" Calculator="Sum" StringFormat="{Binding Source={x:Static inf:FormatStrings.Summaryformat}}" TextBlock.TextAlignment="Right"
You could create a style for the SummaryResultPresenter and bind the FontWeight property to the value with a custom converter.
<converter:FontWeightConverter x:Key="boldConverter"/>
<Style TargetType="{x:Type igDP:SummaryResultPresenter}">
<Setter Property="TextBlock.FontWeight"
Value="{Binding Path=Value,
Converter={StaticResource boldConverter}}" />
</Style>
public class FontWeightConverter:IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
//check the value
return FontWeights.Bold;
}
..
#endregion
Let me know if you have any questions.