AD
Administrator
Syncfusion Team
September 24, 2004 07:37 PM UTC
Hi Colin,
Hiding Column:
--------------
You can hide the columns in the dropdown list by accessing the embedded grid in CurrentCellShowingDropDown.
Please refer this KB article:
http://www.syncfusion.com/Support/article.aspx?id=10353
// Adjust the properties in the Embedded Grid
cr.ListControlPart.Grid.ColWidths[1] = 30;
cr.ListControlPart.Grid.SetRowHidden(1,2,true);
Alignment:
----------
You can subscribe to the Grid''s PrepareViewStyleInfo to set the horizontal alignment.
((GridDropDownGridListControlPart)cr.ListControlPart).Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo);
private void grid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if(e.ColIndex == 2)
{
e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
}
}
DropDownSize:
-------------
You can avoid the width of the dropdown getting larger by explicitly setting the width to some fixed value by handling the CurrentCellShowingDropDown.
For example, setting it to the width to show all the columns.
//at bottom of CurrentCellShowingDropDown.....
int width = cr.ListControlPart.Grid.Model.ColWidths.GetTotal(0, cr.ListControlPart.Grid.Model.ColCount) + 16;
e.Size = new Size( width, e.Size.Height);
We have to address this issue.
Best Regards,
Jay N
AD
Administrator
Syncfusion Team
September 24, 2004 10:24 PM UTC
thanks for the quick response!
got it working perfect with some minor mods:
private void gridDataBoundGrid1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
GridControlBase grid = sender as GridControlBase;
GridCurrentCell cc = grid.CurrentCell;
GridDropDownGridListControlCellRenderer cr = cc.Renderer as GridDropDownGridListControlCellRenderer;
cr.ListControlPart.Grid.SetColHidden(1, 1, true);
((GridDropDownGridListControlPart)cr.ListControlPart).Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(grid_PrepareViewStyleInfo);
int width = cr.ListControlPart.Grid.Model.ColWidths.GetTotal(1, cr.ListControlPart.Grid.Model.ColCount - 1) + 100;
e.Size = new Size(width, e.Size.Height);
}