Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
14439 | May 27,2004 12:58 AM UTC | May 27,2004 10:40 AM UTC | WinForms | 2 |
![]() |
Tags: GridControl |
GridDropDownGridListControlCellRenderer cr = (GridDropDownGridListControlCellRenderer)
this.grid.CellRenderers["GridListControl"];
(( GridDropDownGridListControlPart) cr.ListControlPart).DropDownRows = 2; // 2 rows in the dropdown
If you need to do it on a column by column basis (or cell by cell), then you will have to handle the CurrentCellShowingDropDown event.
private void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e) { GridControlBase grid = sender as GridControlBase; if(grid != null) { GridCurrentCell cc = grid.CurrentCell; GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; if(cc != null) { if(cc.ColIndex == 6) ((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 4; else if(cc.ColIndex == 4) ((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 7; else if(cc.ColIndex == 2) ((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 10; else ((GridComboBoxListBoxPart)cr.ListBoxPart).DropDownRows = 6; } } }
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.