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. Image for the cookie policy date

List in Cells

Is there a way to populate and display lists in cells in the grid, so that the list elements can be moved from one, something similar to the calendar view in MS Outlook, where you can drag and drop appointments to other cells.

2 Replies

AD Administrator Syncfusion Team May 5, 2005 09:25 AM UTC

There are several ways you can do this. There are two parts of the task. One is to put the list in teh cell, and the other is to support the drag/drop behavior you want. If you only have two or three of these types of cells in your grid, then you can use set style.CellType="Control" for each of these cells, and create an instance of the control you want to use (a ListBox, a ListControl, a GridControl, or something else) for each cell and set its style.Control=instanceOfTheControl. Here is a little snippet showing how to put a textbox into a cell as a COntrol celltype. You can do the same with a ListBox or ListControl. TextBox box = new TextBox(); box.Visible = false; box.Multiline = true; box.Text = "Some random text here..."; box.BorderStyle = BorderStyle.None; gridControl1.RowHeights[2] = 30; gridControl1.ColWidths[2] = 200; gridControl1[2,2].CellType = "Control"; gridControl1[2,2].Control = box; this.Controls.Add(box); To support special drag&drop between the cells will take more coding. Here is a Windows Forms kb link that shows how to derive a listbox that support D&D. http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c87c.aspx#q610q You could try using such a listbox. This would allow you to initiate the D&D from your active cell control. You could then try catching the drop in the grid''s DragDrop event, and putting it in the proper position in your target list cell. If you have many cells that you want to behave this way, then you woul dlikely be better off deriving a custom celltype to contain your D&D ListBox (or whatever control you choose). There are samples of deriving such custom cell types in the \Syncfusion\Essential Studio\3.2.1.0\Windows\Grid.Windows\Samples\CellTypes folder. See the CalendarCells or the SliderCells samples. If you want to use a GridControl as the list in the cell, the \Syncfusion\Essential Studio\3.2.1.0\Windows\Grid.Windows\Samples\In Depth\GridInCells sample shows how this can be done.


AD Administrator Syncfusion Team May 6, 2005 12:42 AM UTC

Thanks a lot, Clay, much appreciated

Loader.
Live Chat Icon For mobile
Up arrow icon