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.

How to get converted value in GridCaptionSummaryCell?

Thread ID:

Created:

Updated:

Platform:

Replies:

121458 Dec 16,2015 09:30 AM Dec 17,2015 11:03 PM WPF 1
loading
Tags: SfDataGrid
Benedikt Adamitzki
Asked On December 16, 2015 09:30 AM

Hi All,

my column by which I'd like to group my table, shows values applying a converter. The values in the column are OK i.e. converted. But if I group the table by this column, the caption summary cell shows base values instead of converted ones as key (next to amount). Should the conversion happen automatically as it does within the column or do I have to specify somewhere that this is to be done? If the latter is true, where and how do I have to specify it?

Best regards,
Benedikt

Sivakumar R [Syncfusion]
Replied On December 17, 2015 11:03 PM

Hi Benedikt,

You can customize the caption summary row key based on display value by writing CustomCaptionSummaryRenderer.

//default CaptionSummaryCellRenderer is removed.           

this.AssociatedObject.CellRenderers.Remove("CaptionSummary");


//Customized CaptionSummaryCellRenderer is added.
this.AssociatedObject.CellRenderers.Add("CaptionSummary", new CustomCaptionSummaryCellRenderer());


In the CustomCaptionSummaryCellRenderer caption text is calculated based on Display value instead of actual value.

private string GetCustomizedCaptionText(GridColumn column, object record, int count)

{

    if (propertyprovider == null)

        propertyprovider = this.DataGrid.View.GetPropertyAccessProvider();

    var key = propertyprovider.GetFormattedValue(record, column.MappingName);

    return column.HeaderText + " : " + (key == null ? string.Empty : key.ToString()) + " - " + count.ToString() +

            " Items ";
}


Find the sample from below location,
http://www.syncfusion.com/downloads/support/forum/121458/ze/WPF_-_Copy934553414

Thanks,
Sivakumar


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;