{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "grid-preview-rows",
  "framework": "winforms",
  "type": "registry:component",
  "component": "Grid",
  "variant": "preview-rows",
  "dependencies": [
    "Syncfusion.SfDataGrid.WinForms"
  ],
  "description": "Grid that pairs each parent row with a preview row showing additional details, expanding sub-record content inline beneath the parent.",
  "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-preview-rows.md"
  },
  "files": [
    {
      "target": "src/components/grid-preview-rows/grid.Designer.cs",
      "content": "using Syncfusion.WinForms.DataGrid;\nusing Syncfusion.WinForms.DataGrid.Enums;\nusing System.Windows.Forms;\n\nnamespace PreviewRows\n{\n    /// <summary>\n    /// Summary description for Form1.\n    /// </summary>\n    partial class Form1\n    {\n        /// <summary>\n        /// Required designer variable.\n        /// </summary>\n        private System.ComponentModel.Container components = null;\n\n        /// <summary>\n        /// Clean up any resources being used.\n        /// </summary>\n        /// <param name=\"disposing\">true if managed resources should be disposed; otherwise, false.</param>\n        protected override void Dispose(bool disposing)\n        {\n            if (disposing && (components != null))\n            {\n                components.Dispose();\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.sfDataGrid = new Syncfusion.WinForms.DataGrid.SfDataGrid();\n            ((System.ComponentModel.ISupportInitialize)(this.sfDataGrid)).BeginInit();\n            this.SuspendLayout();\n            //\n            // sfDataGrid\n            //\n            this.sfDataGrid.AccessibleName = \"Table\";\n            this.sfDataGrid.AutoSizeColumnsMode = AutoSizeColumnsMode.Fill;\n            this.sfDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;\n            this.sfDataGrid.Location = new System.Drawing.Point(0, 0);\n            this.sfDataGrid.Name = \"sfDataGrid\";\n            this.sfDataGrid.Size = new System.Drawing.Size(1008, 600);\n            this.sfDataGrid.TabIndex = 0;\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(1024, 615);\n            this.Controls.Add(this.sfDataGrid);\n            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;\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 = \"Preview Rows\";\n            ((System.ComponentModel.ISupportInitialize)(this.sfDataGrid)).EndInit();\n            this.ResumeLayout(false);\n        }\n\n        #endregion\n\n        #region API Definition\n\n        private SfDataGrid sfDataGrid;\n\n        #endregion\n    }\n}"
    },
    {
      "target": "src/components/grid-preview-rows/grid.cs",
      "content": "using Syncfusion.WinForms.Controls;\nusing Syncfusion.WinForms.DataGrid.Styles;\nusing System.Windows.Forms;\nusing Syncfusion.WinForms.DataGrid.Enums;\nusing System.Drawing;\nusing Syncfusion.Data;\nusing Syncfusion.WinForms.DataGrid.Events;\nusing Syncfusion.Windows.Forms;\nusing System;\n\nnamespace PreviewRows\n{\n    public partial class Form1 : Form\n    {\n        #region Constructor\n\n        /// <summary>\n        /// Initializes a new instance of the Form.\n        /// </summary>\n        public Form1()\n        {\n            InitializeComponent();\n            var data = new EmployeeDetails();\n            sfDataGrid.DataSource = data.EmployeeInfoCollection;\n\n            //Enable preview row for the SfDataGrid.\n            sfDataGrid.ShowPreviewRow = true;\n            sfDataGrid.PreviewRowMappingName = \"FirstName\";\n            sfDataGrid.PreviewRowHeight = (int)DpiAware.LogicalToDeviceUnits(114.0f);\n            sfDataGrid.ExpandAllPreviewRow();\n            sfDataGrid.DrawPreviewRow += OnDrawPreviewRow;\n            sfDataGrid.CurrentCellEndEdit += SfDataGrid_CurrentCellEndEdit;\n        }\n\n        #endregion\n\n        #region Method\n\n        private void SfDataGrid_CurrentCellEndEdit(object sender, CurrentCellEndEditEventArgs e)\n        {\n            this.sfDataGrid.TableControl.Invalidate(this.sfDataGrid.TableControl.GetRowRectangle(e.DataRow.Index + 1, false));\n        }\n\n        /// <summary>\n        /// Draws the preview row.\n        /// </summary>\n        /// <param name=\"sender\">The object of the sender.</param>\n        /// <param name=\"e\">An <see cref=\"DrawPreviewRowEventArgs\"/> that contains the event data.</param>\n        private void OnDrawPreviewRow(object sender, DrawPreviewRowEventArgs e)\n        {\n            if (!string.IsNullOrEmpty(e.Text))\n            {\n                var clipbounds = e.Graphics.ClipBounds;\n                e.Graphics.SetClip(e.Bounds);\n\n                var font = e.Style.Font.GetFont();\n                var record = (e.Record as RecordEntry).Data as EmployeeInfo;\n                var headerBrush = new SolidBrush(e.Style.TextColor);\n                var subItemsFont = new Font(\"Segoe UI\", 8f, FontStyle.Bold);\n                var textBrush = new SolidBrush(e.Style.TextColor);\n\n                var rect = new Rectangle(e.Bounds.X + (int)DpiAware.LogicalToDeviceUnits(50f), e.Bounds.Y + (int)DpiAware.LogicalToDeviceUnits(12f), (int)DpiAware.LogicalToDeviceUnits(90f), (int)DpiAware.LogicalToDeviceUnits(90f));\n\n                try\n                {\n#if NETCORE\n                var image = Image.FromFile(\"../../../Images/\" + e.Text + \".png\");\n#else\n                var image = Image.FromFile(@\"..\\..\\Images\\\" + e.Text + \".png\");\n#endif\n                e.Graphics.DrawImage(image, rect);\n                }\n                catch (Exception)\n                {\n                }\n\n                int textWidth1 = (int)e.Graphics.MeasureString(\"First Name\", e.Style.Font.GetFont()).Width + 5;\n                int textWidth2 = (int)e.Graphics.MeasureString(\"Last Name\", e.Style.Font.GetFont()).Width + 5;\n                int textWidth3 = (int)e.Graphics.MeasureString(\"Title\", e.Style.Font.GetFont()).Width + 5;\n                int textWidth4 = (int)e.Graphics.MeasureString(\"Address\", e.Style.Font.GetFont()).Width + 5;\n                int textWidth5 = (int)e.Graphics.MeasureString(\"Postal Code\", e.Style.Font.GetFont()).Width + 5;\n                int textWidth6 = (int)e.Graphics.MeasureString(\"City\", e.Style.Font.GetFont()).Width + 5;\n                int textWidth7 = (int)e.Graphics.MeasureString(\"Phone\", e.Style.Font.GetFont()).Width + 5;\n                int textWidth8 = (int)e.Graphics.MeasureString(\"HireDate\", e.Style.Font.GetFont()).Width + 5;\n\n                e.Graphics.DrawString(\"First Name\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(50f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(7f)));\n                e.Graphics.DrawString(\"Last Name\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(50f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(27f)));\n                e.Graphics.DrawString(\"Title\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(50f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(47f)));\n                e.Graphics.DrawString(\"Address\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(50f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(67f)));\n\n                e.Graphics.DrawString(\":\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(50f) + textWidth1, rect.Y + (int)DpiAware.LogicalToDeviceUnits(7f)));\n                e.Graphics.DrawString(\":\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(50f) + textWidth2, rect.Y + (int)DpiAware.LogicalToDeviceUnits(27f)));\n                e.Graphics.DrawString(\":\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(50f) + textWidth3, rect.Y + (int)DpiAware.LogicalToDeviceUnits(47f)));\n                e.Graphics.DrawString(\":\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(50f) + textWidth4, rect.Y + (int)DpiAware.LogicalToDeviceUnits(67f)));\n\n                e.Graphics.DrawString(record.FirstName, font, textBrush, new PointF(rect.Right + textWidth1 + (int)DpiAware.LogicalToDeviceUnits(60f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(7f)));\n                e.Graphics.DrawString(record.LastName.ToString(), font, textBrush, new PointF(rect.Right + textWidth2 + (int)DpiAware.LogicalToDeviceUnits(60f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(27f)));\n                e.Graphics.DrawString(record.Title.ToString(), font, textBrush, new PointF(rect.Right + textWidth3 + (int)DpiAware.LogicalToDeviceUnits(60f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(47f)));\n                e.Graphics.DrawString(record.Address, font, textBrush, new PointF(rect.Right + textWidth4 + (int)DpiAware.LogicalToDeviceUnits(60f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(67f)));\n\n                e.Graphics.DrawString(\"\\tPostal Code\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(300f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(7f)));\n                e.Graphics.DrawString(\"\\tCity\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(300f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(27f)));\n                e.Graphics.DrawString(\"\\tPhone\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(300f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(47f)));\n                e.Graphics.DrawString(\"\\tHire Date\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(300f), rect.Y + (int)DpiAware.LogicalToDeviceUnits(67f)));\n\n                e.Graphics.DrawString(\":\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(340f) + textWidth5, rect.Y + (int)DpiAware.LogicalToDeviceUnits(7f)));\n                e.Graphics.DrawString(\":\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(340f) + textWidth6, rect.Y + (int)DpiAware.LogicalToDeviceUnits(27f)));\n                e.Graphics.DrawString(\":\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(340f) + textWidth7, rect.Y + (int)DpiAware.LogicalToDeviceUnits(47f)));\n                e.Graphics.DrawString(\":\", subItemsFont, headerBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(340f) + textWidth8, rect.Y + (int)DpiAware.LogicalToDeviceUnits(67f)));\n\n                e.Graphics.DrawString(record.PostalCode, font, textBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(350f) + textWidth5, rect.Y + (int)DpiAware.LogicalToDeviceUnits(7f)));\n                e.Graphics.DrawString(record.City, font, textBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(350f) + textWidth6, rect.Y + (int)DpiAware.LogicalToDeviceUnits(27f)));\n                e.Graphics.DrawString(record.Phone, font, textBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(350f) + textWidth7, rect.Y + (int)DpiAware.LogicalToDeviceUnits(47f)));\n                e.Graphics.DrawString(record.HireDate.ToString(), font, textBrush, new PointF(rect.Right + (int)DpiAware.LogicalToDeviceUnits(350f) + textWidth8, rect.Y + (int)DpiAware.LogicalToDeviceUnits(67f)));\n\n                e.Graphics.DrawLine(new Pen(e.Style.Borders.Bottom.Color), new Point(e.Bounds.Left, e.Bounds.Bottom - 1), new Point(e.Bounds.Right, e.Bounds.Bottom - 1));\n                e.Graphics.DrawLine(new Pen(e.Style.Borders.Right.Color), new Point(e.Bounds.Right - 1, e.Bounds.Top), new Point(e.Bounds.Right - 1, e.Bounds.Bottom - 1));\n                e.Graphics.SetClip(clipbounds);\n                e.Handled = true;\n            }\n        }\n\n        #endregion\n    }\n}"
    }
  ]
}