- Home
- Forum
- Xamarin.iOS
- How to summarize, adding a row in the end and change the column content font color ?
How to summarize, adding a row in the end and change the column content font color ?
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.
https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents
Please let us know if this helps.
Regards,
Harikrishnan
- 1 Reply
- 2 Participants
-
SA SAGE
- Sep 24, 2015 02:17 PM UTC
- Sep 25, 2015 09:59 AM UTC