Grid summary column text alignment

Hi

Is there any way to specify the text alignment for a GridSummaryColumn?

The column it is summarising has a TextAlignment of End but the summary column appears to have an alignment of Start. 

Also, the Summary Column has a Format property containing two sets of curly braces

Format="{}{Sum:c}"

What is the first pair of brackets for?

Here is my XAML

<xForms:SfDataGrid.TableSummaryRows>
<xForms:GridTableSummaryRow Name="TableSummary" 
ShowSummaryInRow="False">
<xForms:GridTableSummaryRow.SummaryColumns>
<xForms:GridSummaryColumn Name="ExSummary"
  MappingName="AmountExGst"
  Format="{}{Sum:c}"
  SummaryType="DoubleAggregate" />
</xForms:GridTableSummaryRow.SummaryColumns>
</xForms:GridTableSummaryRow>
</xForms:SfDataGrid.TableSummaryRows>


1 Reply

AN Ashok N Syncfusion Team December 5, 2017 06:44 AM UTC

Hi Steve, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your query and currently we do not have direct support for setting Alignment for SummaryColumns. We will provide the support for SummaryColumns Alignment based on the GridColumn in our upcoming 2017 Vol 4 SP 1 release, which will be schedule for rollout End of December 2017.  
 
Now you can achieve your requirement by customizing GridTableSummaryCellRenderer based on the requirement. Please refer the below code example for add and remove the CellRenderers in SfDataGrid 
 
dataGrid.CellRenderers.Remove("TableSummary"); 
dataGrid.CellRenderers.Add("TableSummary", new GridTableSummaryCellRendererExt()); 
 
Custom renderer class: 
 
public class GridTableSummaryCellRendererExt : GridTableSummaryCellRenderer 
{ 
    public GridTableSummaryCellRendererExt() 
    { 
    } 
    public override void OnInitializeDisplayView(DataColumnBase dataColumn, SfLabel view) 
    { 
        base.OnInitializeDisplayView(dataColumn, view); 
        view.HorizontalTextAlignment = TextAlignment.End; 
    } 
    public override void OnUpdateDisplayValue(DataColumnBase dataColumn, SfLabel view) 
    { 
        base.OnUpdateDisplayValue(dataColumn, view); 
        view.HorizontalTextAlignment = TextAlignment.End; 
    } 
} 
 
In our source we cannot able to get the proper given format while we set the Format using Xaml page, so we have passed empty parameter for format conversion.  
 
 
Regards, 
Ashok 


Loader.
Up arrow icon