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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to Set the horizontal alignment on summary columns?

The appearance of Summary cells (Table summary, Group summary and Caption summary) are customized by writing styles for those cells. SfDataGrid exposes the properties TableSummaryCellStyle, GroupSummaryCellStyle, CaptionSummaryCellStyle that customizes the appearance of the cell. Also SfDataGrid exposes the following properties to customize the appearance of summary cells conditionally.

Property

Description

TableSummaryCellStyleSelector

Used to customize the alignment of Table Summary cell

GroupSummaryCellStyleSelector

Used to customize the alignment of Group Summary cell.

CaptionSummaryCellStyleSelector

Used to customize the alignment of Caption Summary cell.

 

Now you can learn how to change the horizontal alignment of summary cells for a particular columns only using StyleSelector properties exposed in SfDataGrid. Create a class deriving from StyleSelector and override SelectStyle method (When WinRT overrides SelectStyleCore method) and return styles based on condition. In the SelectStyle override method, you can access the Cell (for eg: GridTableSummaryCell) and from cell you can get the column details and customize the alignment based on column names. Refer the following code example.

C#

 

The following TableSummaryStyle1 and TableSummaryStyle2 styles are returned to the Table Summary Cells based on the column name. Refer the following code example.

XAML

 

The following TableSummaryCellStyleSelector property is used to customize the horizontal alignment of table summary cells. Refer the following code example.

XAML

 

Note: Group Summary cell and Caption Summary cell horizontal alignment are customized like the horizontal alignment customization of Table Summary Cell

 

Refer the following screenshot for horizontal alignment of table summary cell customization.

               

In the above screenshot, horizontal alignment is set as center for Sales in Quarter1, Sales in Quarter2 table summary cells and right for other table summary cells.

Sample Links:

WPF

WRT

UWP

 

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework:
2486 08/12/2014 01/25/2016 WinRT SfDataGrid 4.5
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon