{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "grid-real-time-updates",
  "framework": "winforms",
  "type": "registry:component",
  "component": "Grid",
  "variant": "real-time-updates",
  "dependencies": [
    "Syncfusion.SfDataGrid.WinForms"
  ],
  "description": "Grid that appends rows from a background timer to demonstrate live updates without losing selection and scroll position.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/winforms/llms.txt",
    "skillPack": "syncfusion/winforms-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/winforms/grid-real-time-updates.md"
  },
  "files": [
    {
      "target": "src/components/grid-real-time-updates/grid.Designer.cs",
      "content": "using Syncfusion.Windows.Forms;\nusing Syncfusion.WinForms.DataGrid;\nusing System.Drawing;\nusing System.Windows.Forms;\n\nnamespace RealTimeUpdates\n{\n    partial class Form1\n    {\n        /// <summary>\n        /// Required designer variable.\n        /// </summary>\n        private System.ComponentModel.IContainer components = null;\n\n        /// <summary>\n        /// Clean up any resources being used.\n        /// </summary>\n        protected override void Dispose(bool disposing)\n        {\n            if (disposing && (components != null))\n            {\n                components.Dispose();\n                //Disposing events\n                sfDataGrid.DrawCell -= SfDataGrid_DrawCell;\n                startTimerBtn.Click -= ButtonClick_Click;\n                frequencySlider.Scroll -= FrequencySlider_Scroll;\n            }\n            base.Dispose(disposing);\n        }\n\n        #region Windows Form Designer generated code\n\n        /// <summary>\n        /// Required method for Designer support - do not modify\n        /// the contents of this method with the code editor.\n        /// </summary>\n        private void InitializeComponent()\n        {\n            this.optionLabel = new System.Windows.Forms.Label();\n            this.sfDataGrid = new Syncfusion.WinForms.DataGrid.SfDataGrid();\n            this.frequencyLbl = new System.Windows.Forms.Label();\n            this.timerStatusLbl = new System.Windows.Forms.Label();\n            this.frequencyRangeLbl = new System.Windows.Forms.Label();\n            this.maxfrequency = new System.Windows.Forms.Label();\n            this.numOfUpdate = new System.Windows.Forms.Label();\n            this.frequencySlider = new System.Windows.Forms.TrackBar();\n            this.startTimerBtn = new System.Windows.Forms.Button();\n            this.frequencyChanging = new System.Windows.Forms.Label();\n            ((System.ComponentModel.ISupportInitialize)(this.sfDataGrid)).BeginInit();\n            ((System.ComponentModel.ISupportInitialize)(this.frequencySlider)).BeginInit();\n            this.SuspendLayout();\n            //\n            // optionLabel\n            //\n            this.optionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.optionLabel.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F, System.Drawing.FontStyle.Bold);\n            this.optionLabel.Location = new System.Drawing.Point(814, 22);\n            this.optionLabel.Name = \"optionLabel\";\n            this.optionLabel.Size = new System.Drawing.Size(100, 33);\n            this.optionLabel.TabIndex = 4;\n            this.optionLabel.Text = \"Options:\";\n            //\n            // sfDataGrid\n            //\n            this.sfDataGrid.AccessibleName = \"Table\";\n            this.sfDataGrid.AllowEditing = false;\n            this.sfDataGrid.AllowGrouping = false;\n            this.sfDataGrid.AllowSorting = false;\n            this.sfDataGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)\n            | System.Windows.Forms.AnchorStyles.Left)\n            | System.Windows.Forms.AnchorStyles.Right)));\n            this.sfDataGrid.AutoSizeColumnsMode = Syncfusion.WinForms.DataGrid.Enums.AutoSizeColumnsMode.Fill;\n            this.sfDataGrid.BackColor = System.Drawing.SystemColors.Window;\n            this.sfDataGrid.Location = new System.Drawing.Point(10, 5);\n            this.sfDataGrid.Name = \"sfDataGrid\";\n            this.sfDataGrid.RowHeight = (int)DpiAware.LogicalToDeviceUnits(21.0f);\n            this.sfDataGrid.Size = new System.Drawing.Size(787, 578);\n            this.sfDataGrid.TabIndex = 0;\n            //\n            // frequencyLbl\n            //\n            this.frequencyLbl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.frequencyLbl.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F, System.Drawing.FontStyle.Bold);\n            this.frequencyLbl.Location = new System.Drawing.Point(842, 55);\n            this.frequencyLbl.Name = \"frequencyLbl\";\n            this.frequencyLbl.Size = new System.Drawing.Size(141, 29);\n            this.frequencyLbl.TabIndex = 5;\n            this.frequencyLbl.Text = \"Timer Frequency:\";\n            //\n            // timerStatusLbl\n            //\n            this.timerStatusLbl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.timerStatusLbl.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F, System.Drawing.FontStyle.Bold);\n            this.timerStatusLbl.Location = new System.Drawing.Point(842, 162);\n            this.timerStatusLbl.Name = \"timerStatusLbl\";\n            this.timerStatusLbl.Size = new System.Drawing.Size(100, 23);\n            this.timerStatusLbl.TabIndex = 3;\n            this.timerStatusLbl.Text = \"Start /Stop Timer\";\n            //\n            // frequencyRangeLbl\n            //\n            this.frequencyRangeLbl.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F);\n            this.frequencyRangeLbl.Location = new System.Drawing.Point(21, 9);\n            this.frequencyRangeLbl.Name = \"frequencyRangeLbl\";\n            this.frequencyRangeLbl.Size = new System.Drawing.Size(125, 20);\n            this.frequencyRangeLbl.TabIndex = 6;\n            this.frequencyRangeLbl.Text = \"Timer Frequency :\";\n            //\n            // maxfrequency\n            //\n            this.maxfrequency.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F, System.Drawing.FontStyle.Bold);\n            this.maxfrequency.Location = new System.Drawing.Point(415, 9);\n            this.maxfrequency.Name = \"maxfrequency\";\n            this.maxfrequency.Size = new System.Drawing.Size(200, 20);\n            this.maxfrequency.TabIndex = 7;\n            this.maxfrequency.Text = \"1000\";\n            //\n            // numOfUpdate\n            //\n            this.numOfUpdate.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F);\n            this.numOfUpdate.Location = new System.Drawing.Point(299, 9);\n            this.numOfUpdate.Name = \"numOfUpdate\";\n            this.numOfUpdate.Size = new System.Drawing.Size(110, 20);\n            this.numOfUpdate.TabIndex = 8;\n            this.numOfUpdate.Text = \"No Of Updates :\";\n            //\n            // frequencySlider\n            //\n            this.frequencySlider.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.frequencySlider.LargeChange = 100;\n            this.frequencySlider.Location = new System.Drawing.Point(845, 97);\n            this.frequencySlider.Maximum = 1000;\n            this.frequencySlider.Minimum = 100;\n            this.frequencySlider.Name = \"frequencySlider\";\n            this.frequencySlider.Size = new System.Drawing.Size(104, 45);\n            this.frequencySlider.TabIndex = 2;\n            this.frequencySlider.TickFrequency = 200;\n            this.frequencySlider.Value = 100;\n            this.frequencySlider.Scroll += new System.EventHandler(this.FrequencySlider_Scroll);\n            //\n            // startTimerBtn\n            //\n            this.startTimerBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.startTimerBtn.Location = new System.Drawing.Point(845, 206);\n            this.startTimerBtn.Name = \"startTimerBtn\";\n            this.startTimerBtn.Size = new System.Drawing.Size(100, 33);\n            this.startTimerBtn.TabIndex = 1;\n            this.startTimerBtn.Text = \"Stop Timer\";\n            this.startTimerBtn.Click += new System.EventHandler(this.ButtonClick_Click);\n            //\n            // frequencyChanging\n            //\n            this.frequencyChanging.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F, System.Drawing.FontStyle.Bold);\n            this.frequencyChanging.Location = new System.Drawing.Point(152, 9);\n            this.frequencyChanging.Name = \"frequencyChanging\";\n            this.frequencyChanging.Size = new System.Drawing.Size(150, 20);\n            this.frequencyChanging.TabIndex = 9;\n            this.frequencyChanging.Text = \"100 ms\";\n            //\n            // Form1\n            //\n            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\n            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\n            this.BackColor = System.Drawing.SystemColors.Window;\n            this.ClientSize = new System.Drawing.Size(1006, 593);\n            this.Controls.Add(this.sfDataGrid);\n            this.Controls.Add(this.startTimerBtn);\n            this.Controls.Add(this.frequencySlider);\n            this.Controls.Add(this.timerStatusLbl);\n            this.Controls.Add(this.optionLabel);\n            this.Controls.Add(this.frequencyLbl);\n            this.Controls.Add(this.frequencyRangeLbl);\n            this.Controls.Add(this.maxfrequency);\n            this.Controls.Add(this.numOfUpdate);\n            this.Controls.Add(this.frequencyChanging);\n            this.Margin = new System.Windows.Forms.Padding(5);\n            this.MinimumSize = new System.Drawing.Size(500, 400);\n            this.Name = \"Form1\";\n            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;\n            this.Text = \"Real-Time Update\";\n            ((System.ComponentModel.ISupportInitialize)(this.sfDataGrid)).EndInit();\n            ((System.ComponentModel.ISupportInitialize)(this.frequencySlider)).EndInit();\n            this.ResumeLayout(false);\n            this.PerformLayout();\n\n        }\n        #endregion\n\n        #region Private members\n\n        private SfDataGrid sfDataGrid;\n        private Label optionLabel;\n        private Label frequencyLbl;\n        private Label frequencyRangeLbl;\n        private Button startTimerBtn;\n        private TrackBar frequencySlider;\n        private Label timerStatusLbl;\n        private Label maxfrequency;\n        private Label numOfUpdate;\n        private Label frequencyChanging;\n        private StocksDataCollection collection;\n        #endregion\n    }\n}"
    },
    {
      "target": "src/components/grid-real-time-updates/grid.cs",
      "content": "using System;\nusing System.Drawing;\nusing System.Reflection;\nusing System.Windows.Forms;\nusing System.Windows.Forms.VisualStyles;\nusing Syncfusion.WinForms.DataGrid.Styles;\nusing Syncfusion.WinForms.DataGrid.Helpers;\nusing Syncfusion.WinForms.DataGrid;\nusing Syncfusion.WinForms.DataGrid.Enums;\nusing Syncfusion.WinForms.DataGrid.Events;\nusing Syncfusion.WinForms.Core;\nusing Syncfusion.WinForms.Core.Enums;\n\nnamespace RealTimeUpdates\n{\n    public partial class Form1 : Form\n    {\n        #region Constructor\n        public Form1()\n        {\n            InitializeComponent();\n            collection = new StocksDataCollection();\n            sfDataGrid.DataSource = collection.Stocks;\n            sfDataGrid.DrawCell += SfDataGrid_DrawCell;\n        }\n\n        #endregion\n\n        #region Event_Method\n\n        /// <summary>\n        /// Sets track bar changed to timer.\n        /// </summary>\n        private void FrequencySlider_Scroll(object sender, EventArgs e)\n        {\n            double ms = frequencySlider.Value * 2321;\n            if (frequencySlider.Value == 100 || frequencySlider.Value == 1000)\n                frequencyChanging.Text = \"\" + frequencySlider.Value + \" ms\";\n            else\n                frequencyChanging.Text = \"\" + frequencySlider.Value + \".\" + ms + \" ms\";\n\n            collection.StartTimer(frequencySlider.Value);\n            startTimerBtn.Text = \"Stop Timer\";\n        }\n\n        /// <summary>\n        /// Used to Start and Stop the timer in button click.\n        /// </summary>\n        private void ButtonClick_Click(object sender, EventArgs e)\n        {\n            if (startTimerBtn.Text == \"Start Timer\")\n            {\n                collection.StartTimer(frequencySlider.Value);\n                startTimerBtn.Text = \"Stop Timer\";\n            }\n            else\n            {\n                collection.StopTimer();\n                startTimerBtn.Text = \"Start Timer\";\n            }\n        }\n\n        /// <summary>\n        /// Used to customize the cell.\n        /// </summary>\n        private void SfDataGrid_DrawCell(object sender, DrawCellEventArgs e)\n        {\n            if (this.sfDataGrid.CurrentCell != null && this.sfDataGrid.CurrentCell.IsEditing)\n                return;\n\n            if (e.Column.MappingName == \"Change\" && e.DataRow.RowType == RowType.DefaultRow)\n            {\n                var graphics = e.Graphics;\n                var rect = e.Bounds;\n                Rectangle rect1 = new Rectangle(rect.X + 20, rect.Y + 6, rect.Width / 6, rect.Height / 2);\n                StringFormat format = new StringFormat();\n\n                e.Style.HorizontalAlignment = HorizontalAlignment.Center;\n                var drawingObj = new DrawingHelper();\n                var value = drawingObj.GetType().GetMethod(\"ConvertToStringAlignment\", BindingFlags.NonPublic | BindingFlags.Static, Type.DefaultBinder, new Type[] { typeof(HorizontalAlignment) }, null).Invoke(drawingObj, new object[] { e.Style.HorizontalAlignment });\n                format.Alignment = (StringAlignment)value;\n\n                var value1 = drawingObj.GetType().GetMethod(\"ConvertToStringAlignment\", BindingFlags.NonPublic | BindingFlags.Static, Type.DefaultBinder, new Type[] { typeof(System.Windows.Forms.VisualStyles.VerticalAlignment) }, null).Invoke(drawingObj, new object[] { e.Style.VerticalAlignment });\n                format.LineAlignment = (StringAlignment)value1;\n\n                if ((e.DataRow.RowData as StockData).Change > 0)\n                {\n                    ShapesPainter.DrawTriangle(graphics, rect1, TriangleDirection.Up, Brushes.Green, new Pen(Color.Green), true);\n                    graphics.DrawString(e.DisplayText, e.Style.Font.GetFont(), new SolidBrush(Color.Green), rect.X + 92, rect.Y + 13, format);\n                }\n                else\n                {\n                    ShapesPainter.DrawTriangle(graphics, rect1, TriangleDirection.Down, Brushes.Red, new Pen(Color.Red), true);\n                    graphics.DrawString(e.DisplayText, e.Style.Font.GetFont(), new SolidBrush(Color.Red), rect.X + 90, rect.Y + 13, format);\n                }\n                Pen borderPen = new Pen(Brushes.LightGray);\n                graphics.DrawLine(borderPen, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom);\n                graphics.DrawLine(borderPen, rect.Left, rect.Bottom - 1, rect.Right, rect.Bottom - 1);\n                e.Handled = true;\n            }\n        }\n        #endregion\n    }\n}"
    }
  ]
}