I have a SummaryDefinition that is the sum of decimals. I need it to display in parentheses if a property (not in the XamDataGrid) has a specific value. A FormatString can't help because the sum always has the same sign. I was hoping to use a converter but I don't see an option to specify a converter.
I want the solution to be in XAML (or at least easily reusable). This has to be done on a lot of grids.
Do I have to do this with a custom calculator? Is there a simpler way?Thanks
Hello Harry,
I have been investigating into the behavior you are looking to achieve, and currently, the StringFormat and StringFormatProvider properties on the SummaryDefinition are the route to modify the display text of the summaries.
An alternate, but rather hacky route in this case could also be to include the default style for SummaryResultPresenter and apply a Converter to the TextBlock in its ControlTemplate to modify the text that way. For reference, here is that default style:
<Style TargetType="{x:Type igDP:SummaryResultPresenter}"> <Setter Property="Padding" Value="1,1"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:SummaryResultPresenter}"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Padding="{TemplateBinding Padding}" ToolTip="{Binding Path=SummaryResult.ToolTipResolved, RelativeSource={RelativeSource TemplatedParent}}"> <!-- SSP 3/19/10 - Optimizations Changed the binding to bind to the new DisplayTextAsync instead of the DisplayText so we don't force synchronous calculation of the summary if it's dirty. --> <TextBlock Text="{Binding Path=SummaryResult.DisplayTextAsync, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"/> </Border> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="Margin" Value="0,0,0,2"/> </Style>
If you would like to see a converter potentially implemented in a future version of the SummaryDefinitions for the XamDataGrid, I would recommend suggesting a new feature for this at our product ideas site for Infragistics for WPF, here: https://ko.infragistics.com/community/ideas/i/ultimate-ui-for-wpf. This will place you in direct communication with our product management teams who plan and prioritize upcoming features and development based on community and user feedback.
Please let me know if you have any other questions or concerns on this matter.