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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Customise the NumberFormatInfo used in a GridSummaryColumn

Thread ID:

Created:

Updated:

Platform:

Replies:

119409 Jun 17,2015 09:36 AM UTC Jun 22,2015 04:08 AM UTC WPF 3
loading
Tags: SfDataGrid
Anas El Hallabi
Asked On June 17, 2015 09:36 AM UTC

Hello,

Is there a way to cutomize the NumberFormatInfo(NumberDecimalSeparator, NumberGroupSeparator, NumberDecimalDigits, NumberGroupSizes) used in a GridSummaryColumn Format property ? by default, it is using the CultureInfo of the application.
What i'm trying to do is allow the user to change NumberFormatInfo of the displayed GridSummaryColumn in a GridTableSummaryRow.

Many thanks,
Anas

Jayapradha S [Syncfusion]
Replied On June 19, 2015 02:50 AM UTC

Hi Anas,

Thank you for using Syncfusion products.


We have analyzed your requirement and you can use NumberFormatInfo properties to apply the format for Summary columns by overriding the GridTableSummaryCellRenderer as shown in the below code snippet,


Code Snippet:

  public override void OnUpdateEditBinding(Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex cellRowcolumnIndex, Syncfusion.UI.Xaml.Grid.GridTableSummaryCell element, Syncfusion.UI.Xaml.Grid.GridColumn column, object dataContext)

        {

            base.OnUpdateEditBinding(cellRowcolumnIndex, element, column, dataContext);

            var record = dataContext as SummaryRecordEntry;

            if (dataContext is SummaryRecordEntry)

            {

                foreach (ISummaryColumn summaryColumn in record.SummaryRow.SummaryColumns)

                {

                    if (summaryColumn.MappingName.Contains(column.MappingName))

                    {


                        if (record.SummaryRow.ShowSummaryInRow)

                            element.Content = SummaryCreator.GetSummaryDisplayTextForRow(record, this.DataGrid.View);


                        else

                            element.Content = SummaryCreator.GetSummaryDisplayText(record, column.MappingName, this.DataGrid.View);


                        NumberFormatInfo format = new NumberFormatInfo();

                        format.NumberDecimalDigits = 3;

                        format.NumberDecimalSeparator = ",";

                        format.NumberGroupSeparator = "*";

                        if (element.Content != string.Empty)

                            element.Content = Convert.ToDouble(element.Content).ToString("C", format);


                    }

                }
            }



We have prepared  a sample for your requirement and please find the sample from the below location,

Sample Link: 
CustomNumberFormat_Summary


Kindly let us know if you require any further assistance on this.

Regards,

Jayapradha

Anas El Hallabi
Replied On June 19, 2015 11:45 AM UTC

Hello Jayapradha,
Thank your for your answer. I was able to modify the NumberFormatInfo properties for summary columns.

Anas

Jayapradha S [Syncfusion]
Replied On June 22, 2015 04:08 AM UTC

Hi Anas,

Thank you for your update.

Please let us know if you have any other queries.

Regards,
Jayapradha


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.

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

;