Problem with CellType Control as ListBox

1. Below is a sample code with ListBox used as Control in a GridControl cell. First problem is the List Box in a cell is never exactly same height as the row/cell height no matter what I try to do (changing ListBox height in gridRowHeightsChanged event handler, setting ListBox.Dock to Fill, etc.).

2. Second, while list box cell is focused in the first row and trying to change the row height of the next row, the focused list box cell starts to flicker or repaint itself making it impossible to select list box items.

Please help. Thanks a lot!


GridListBoxCell.zip

3 Replies

AD Administrator Syncfusion Team January 8, 2007 04:16 AM UTC

Hi Ivan,

Do you want a grid with a single ListBox cell or a grid with many ListBox cells?

If you want a single ListBox cell, then create an instance of your ListBox control. Then add the ListBox control through the Indexer of the grid (grid[row,col].Control = yourInstanceOfListBox) or subscribe to the QueryCellInfo event in the grid. If e.RowIndex/e.ColIndex points to the cell where you want to see this ListBox, then set e.Style.Control = yourInstanceOfListBox and set e.Style.CellType = "Control".

If you want many ListBox cells, then your would have to derive a custom cell type like the ones in \4.4.0.49\windows\Grid.Windows\Samples\CustomCellTypes\CalendarCells\. Then to use your custom cell type in a GC, you need to register this celltype with the grid as shown in this sample.s\Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\CustomCellTypes

Best Regards,
Haneef


IM Ivan Moskvic January 8, 2007 09:54 PM UTC

Hi Haleef,

1.Regarding single ListBox cell, this is exactly how I create ListBox control in a single cell (PLEASE see the attached sample code above). You mentioned no solutions for the described problems (focused ListBox cell flickers, makes impossible to edit after next row is resized; cannot resize ListBox to have same height as its cell’s height – there is always a padding between ListBox control bottom and its cell bottom).

2.Regarding many ListBox cells, why is there a difference in implementation for having a ListBox control in one cell or in many cells?

3.Maybe there is an easier way to have a simple ListBox control in a cell? Please let me know or change my sample.

Thank you!


IM Ivan Moskvic January 9, 2007 01:45 AM UTC

I am using Syncfusion GridListControl instead of ListBox now. So far I am not experiencing the problems. Thanks anyway.

Loader.
Up arrow icon