{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "grid-interval-grouping",
  "framework": "winforms",
  "type": "registry:component",
  "component": "Grid",
  "variant": "interval-grouping",
  "dependencies": [
    "Syncfusion.SfDataGrid.WinForms"
  ],
  "description": "Grid that groups rows by ShippedDate month and Order ID, applying a custom KeySelector and a SortComparer per column to an Orders data source.",
  "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-interval-grouping.md"
  },
  "files": [
    {
      "target": "src/components/grid-interval-grouping/grid.Designer.cs",
      "content": "using Syncfusion.Windows.Forms;\nusing Syncfusion.WinForms.DataGrid;\nusing Syncfusion.WinForms.DataGrid.Enums;\nusing System.Windows.Forms;\n\nnamespace IntervalGrouping\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        /// <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.sfDataGrid1 = new Syncfusion.WinForms.DataGrid.SfDataGrid();\n            this.label3 = new System.Windows.Forms.Label();\n            this.label4 = new System.Windows.Forms.Label();\n            this.label5 = new System.Windows.Forms.Label();\n            this.label6 = new System.Windows.Forms.Label();\n            this.label7 = new System.Windows.Forms.Label();\n            this.label8 = new System.Windows.Forms.Label();\n            this.label9 = new System.Windows.Forms.Label();\n            this.label10 = new System.Windows.Forms.Label();\n            ((System.ComponentModel.ISupportInitialize)(this.sfDataGrid1)).BeginInit();\n            this.SuspendLayout();\n            //\n            // sfDataGrid1\n            //\n            this.sfDataGrid1.AccessibleName = \"Table\";\n            this.sfDataGrid1.AllowEditing = false;\n            this.sfDataGrid1.AllowFiltering = true;\n            this.sfDataGrid1.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.sfDataGrid1.AutoSizeColumnsMode = Syncfusion.WinForms.DataGrid.Enums.AutoSizeColumnsMode.Fill;\n            this.sfDataGrid1.Location = new System.Drawing.Point(10, 5);\n            this.sfDataGrid1.Margin = new System.Windows.Forms.Padding(5);\n            this.sfDataGrid1.Name = \"sfDataGrid1\";\n            this.sfDataGrid1.RowHeight = (int)DpiAware.LogicalToDeviceUnits(21.0f);\n            this.sfDataGrid1.ShowGroupDropArea = true;\n            this.sfDataGrid1.Size = new System.Drawing.Size(708, 540);\n            this.sfDataGrid1.TabIndex = 1;\n            this.sfDataGrid1.Text = \"sfDataGrid1\";\n            //\n            // label3\n            //\n            this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.label3.AutoSize = true;\n            this.label3.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.label3.Location = new System.Drawing.Point(733, 39);\n            this.label3.Name = \"label3\";\n            this.label3.Size = new System.Drawing.Size(153, 20);\n            this.label3.TabIndex = 3;\n            this.label3.Text = \"Interval Grouping\";\n            //\n            // label4\n            //\n            this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.label4.AutoSize = true;\n            this.label4.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.label4.Location = new System.Drawing.Point(733, 83);\n            this.label4.Name = \"label4\";\n            this.label4.Size = new System.Drawing.Size(217, 20);\n            this.label4.TabIndex = 4;\n            this.label4.Text = \"Order Id, Freight Column\";\n            //\n            // label5\n            //\n            this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.label5.AutoSize = true;\n            this.label5.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.label5.Location = new System.Drawing.Point(731, 148);\n            this.label5.Name = \"label5\";\n            this.label5.Size = new System.Drawing.Size(303, 20);\n            this.label5.TabIndex = 5;\n            this.label5.Text = \"Customer ID, Ship Country Column\";\n            //\n            // label6\n            //\n            this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.label6.AutoSize = true;\n            this.label6.Location = new System.Drawing.Point(767, 108);\n            this.label6.Name = \"label6\";\n            this.label6.Size = new System.Drawing.Size(175, 17);\n            this.label6.TabIndex = 6;\n            this.label6.Text = \"Groups based on Intervals\";\n            //\n            // label7\n            //\n            this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.label7.AutoSize = true;\n            this.label7.Location = new System.Drawing.Point(767, 173);\n            this.label7.Name = \"label7\";\n            this.label7.Size = new System.Drawing.Size(205, 17);\n            this.label7.TabIndex = 7;\n            this.label7.Text = \"Groups based on starting letter\";\n            //\n            // label8\n            //\n            this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.label8.AutoSize = true;\n            this.label8.Font = new System.Drawing.Font(\"Microsoft Sans Serif\", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\n            this.label8.Location = new System.Drawing.Point(731, 217);\n            this.label8.Name = \"label8\";\n            this.label8.Size = new System.Drawing.Size(296, 20);\n            this.label8.TabIndex = 8;\n            this.label8.Text = \"Order Date, Shipped Date Column\";\n            //\n            // label9\n            //\n            this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.label9.AutoSize = true;\n            this.label9.Location = new System.Drawing.Point(767, 258);\n            this.label9.Name = \"label9\";\n            this.label9.Size = new System.Drawing.Size(275, 17);\n            this.label9.TabIndex = 9;\n            this.label9.Text = \"Order Date - Groups based on date range\";\n            //\n            // label10\n            //\n            this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\n            this.label10.AutoSize = true;\n            this.label10.Location = new System.Drawing.Point(767, 289);\n            this.label10.Name = \"label10\";\n            this.label10.Size = new System.Drawing.Size(260, 17);\n            this.label10.TabIndex = 10;\n            this.label10.Text = \"Shipped Date - Groups based on month\";\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.Color.White;\n            this.Size = new System.Drawing.Size(1024, 640);\n            this.Controls.Add(this.label10);\n            this.Controls.Add(this.label9);\n            this.Controls.Add(this.label8);\n            this.Controls.Add(this.label7);\n            this.Controls.Add(this.label6);\n            this.Controls.Add(this.label5);\n            this.Controls.Add(this.label4);\n            this.Controls.Add(this.label3);\n            this.Controls.Add(this.sfDataGrid1);\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 = \"Interval Grouping\";\n            ((System.ComponentModel.ISupportInitialize)(this.sfDataGrid1)).EndInit();\n            this.ResumeLayout(false);\n            this.PerformLayout();\n\n        }\n\n        #endregion\n\n        #region API Definition\n\n        private SfDataGrid sfDataGrid1;\n        private Label label3;\n        private Label label4;\n        private Label label5;\n        private Label label6;\n        private Label label7;\n        private Label label8;\n        private Label label9;\n        private Label label10;\n\n        #endregion\n\n    }\n}"
    },
    {
      "target": "src/components/grid-interval-grouping/grid.cs",
      "content": "using Syncfusion.Data;\nusing Syncfusion.WinForms.DataGrid;\nusing System.Globalization;\nusing System.Windows.Forms;\n\nnamespace IntervalGrouping\n{\n    public partial class Form1 : Form\n    {\n        public Form1()\n        {\n            InitializeComponent();\n            OrderInfoCollection orderInfo = new OrderInfoCollection();\n            sfDataGrid1.DataSourceChanged += SfDataGrid1_DataSourceChanged;\n            sfDataGrid1.BeginUpdate();\n            sfDataGrid1.DataSource = orderInfo.OrdersListDetails;\n            this.sfDataGrid1.SortComparers.Add(new SortComparer()\n            {\n                PropertyName = \"ShippedDate\",\n                Comparer = new GroupDateComparer(),\n            });\n\n            this.sfDataGrid1.SortComparers.Add(new SortComparer()\n            {\n                PropertyName = \"OrderID\",\n                Comparer = new GroupNumericComparer(),\n            });\n\n            this.sfDataGrid1.GroupColumnDescriptions.Add(new GroupColumnDescription()\n            {\n                ColumnName = \"ShippedDate\",\n                KeySelector = (string ColumnName, object o) =>\n                {\n                    var shipDate = (o as OrderInfo).ShippedDate;\n                    return shipDate.ToString(\"MMMM yyyy\");\n                }\n            });\n\n            sfDataGrid1.EndUpdate();\n        }\n\n        private void SfDataGrid1_DataSourceChanged(object sender, Syncfusion.WinForms.DataGrid.Events.DataSourceChangedEventArgs e)\n        {\n            if (e.NewView != null)\n                e.NewView.GroupDescriptions.CollectionChanged += GroupDescriptions_CollectionChanged;\n            if (e.OldView != null)\n                e.NewView.GroupDescriptions.CollectionChanged -= GroupDescriptions_CollectionChanged;\n        }\n\n        private void GroupDescriptions_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)\n        {\n            if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)\n            {\n                if ((e.NewItems[0] as ColumnGroupDescription).PropertyName == \"OrderID\")\n                {\n                    (e.NewItems[0] as ColumnGroupDescription).KeySelector = (string OrderID, object o) =>\n                    {\n                        var orderID = (o as OrderInfo).OrderID;\n                        var i = (int)orderID / 10;\n                        int GroupingIntervalFrom = (int)i * 10;\n                        int GroupingIntervalTo = ((int)i + 1) * 10;\n                        return GroupingIntervalFrom.ToString(CultureInfo.InvariantCulture) + \" to \" + GroupingIntervalTo.ToString(CultureInfo.InvariantCulture);\n                    };\n                }\n\n                if ((e.NewItems[0] as ColumnGroupDescription).PropertyName == \"ShippedDate\")\n                {\n                    (e.NewItems[0] as ColumnGroupDescription).KeySelector = (string ShippedDate, object o) =>\n                    {\n                        var shipDate = (o as OrderInfo).ShippedDate;\n                        return shipDate.ToString(\"MMMM yyyy\");\n                    };\n                }\n\n                if ((e.NewItems[0] as ColumnGroupDescription).PropertyName == \"CustomerID\")\n                {\n                    (e.NewItems[0] as ColumnGroupDescription).KeySelector = (string CustomerID, object o) =>\n                    {\n                        var customerID = (o as OrderInfo).CustomerID;\n                        return customerID[0];\n                    };\n                }\n\n                if ((e.NewItems[0] as ColumnGroupDescription).PropertyName == \"ShipCountry\")\n                {\n                    (e.NewItems[0] as ColumnGroupDescription).KeySelector = (string ShipCountry, object o) =>\n                    {\n                        var shipCountry = (o as OrderInfo).ShipCountry;\n                        return shipCountry[0];\n                    };\n                }\n            }\n        }\n    }\n}"
    }
  ]
}