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

How to summarize, adding a row in the end and change the column content font color ?

Thread ID:





120539 Sep 24,2015 02:17 PM UTC Sep 25,2015 09:59 AM UTC Xamarin.iOS 1
Tags: SfDataGrid
Asked On September 24, 2015 02:17 PM UTC

Hi! I'm Raphael, and I'm using sfDataGrid for Xamarin.iOS unified.

I have a datagrid with two columns: "Name" and "Total".


 -------------   ----------
|    Name     |    Total   |
 -------------   ----------
|  Raphael    |    200,00 |
|  Carlos       |    150,00 |
|  David        |      20,00 |
 -------------   ----------

I need to put an "extra row" with the total value

Something like

 -------------   -----------
|    Name     |    Total    |
 -------------   -----------
|  Raphael    |    200,00  |
|  Carlos       |    150,00  |
|  David        |      20,00  |
|  TOTAL     |     (SUM) |
 -------------   -----------

And this "total row", just for the "total column" (not the "name column) I need to change the font color for green (or red in case of negative values) in execution time.

How can I do this two things ?

Can you help me?


Harikrishnan N [Syncfusion]
Replied On September 25, 2015 09:59 AM UTC

Hi Raphael,

Thank you for using Syncfusion Products.

In SfDataGrid, you can change the font color of the text inside the GridCell in execution time by customizing the GridCell. You can add views inside the GridCell and customize the text color in the LayoutSubViews from the sample based on your requirement. Please refer the below code example to know about “how to customize a GridCell”.

GridTextColumn customColumn = new GridTextColumn();

customColumn.UserCellType = typeof(CustomCell);

customColumn.MappingName = "CustomColumn";

public class CustomCell : GridCell


            UILabel stocktext;

            public CustomCell ()


                        stocktext = new UILabel ();

                        stocktext.Font = UIFont.SystemFontOfSize (20);

                        this.Add (stocktext);

                        this.CanRenderUnLoad = false;


            protected override void UnLoad ()


                        this.RemoveFromSuperview ();


            public override void LayoutSubviews ()


                        base.LayoutSubviews ();

                        if (Convert.ToDouble (DataColumn.CellValue) < 0) {

            this.stocktext.TextColor = UIColor.Red;

                        } else {

            this.stocktext.TextColor = UIColor.Green;


                        this.stocktext.Frame = new CoreGraphics.CGRect (Bounds.Left, Bounds.Top, Bounds.Width, Bounds.Height);

       this.stocktext.Font = DataColumn.GridColumn.RecordFont;

        this.stocktext.TextAlignment = UITextAlignment.Right;

                        this.stocktext.Text = DataColumn.CellValue.ToString ();


            protected override void Dispose (bool disposing)


                        if (stocktext != null) {

                                    stocktext.Dispose ();

                                    stocktext = null;


                        base.Dispose (disposing);


For more details about customizing the GridCell in SfDataGrid, please refer the Formatting sample and RenderingDynamicData sample in our Demo samples.

Regarding your query to put an extra row to display the summary information in SfDataGrid:
Currently there is no support for this, however we have already considered this as a feature. A support incident to track the status of this feature has been created under your account. Please log on to our support website to check the further updates.


Please let us know if this helps.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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