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

DropDownGrid DropdownButton

Hi, I have a 10 column grid and one of those columns expands to a dropdown grid when clicked. I wanted to change the cell type to a pushbutton instead of a combo box. So in the DropDownGridCellRenderer constructor I added the following lines: DropDownButton = new GridCellButton(this); this.DropDownButton.Text = "Edit"; and set the button size by setting the property ButtonBarSize in the CellModel Constructor. My questions are: 1. I see the button only when I click on the cell in the parent grid. I want the button to be seen for that cell in all the rows in the grid. How do I achieve that? 2. I want the button to fill up the entire cell, how do I determine the values to pass to ButtonBarSize so that the button takes up the entire cell? Thanks,

4 Replies

AD Administrator Syncfusion Team May 11, 2005 10:15 PM UTC

Try adding this Draw override to the Renderer class. It handled both th eproblmes you mentioned for me in our sample.
public override void Draw(Graphics g, Rectangle cellRectangle, int rowIndex, int colIndex, GridStyleInfo style)
{
	this.Model.ButtonBarSize =  new Size(this.Grid.Model.ColWidths[ColIndex]-4, this.Grid.Model.RowHeights[RowIndex]-4);

	base.Draw (g, cellRectangle, rowIndex, colIndex, style);
}


AD Administrator Syncfusion Team May 11, 2005 11:00 PM UTC

Clay, Thanks for your response. Your suggestion solved problem 2, however I still see problem 1. To explain the problem a little better, here is what is happening. Say I have 5 rows in the parent grid (and 10 columns). Initially, none of the rows in the grid have the dropdown button visible. When I click on the cell of a row, the button becomes visible only for that row and disappears again when I click another row. WHat I want to achieve is the button should be visible all all times on all rows of the parent grid and one click should bring up the dropdown grid. Thanks for your help, >Try adding this Draw override to the Renderer class. It handled both th eproblmes you mentioned for me in our sample. > >
>public override void Draw(Graphics g, Rectangle cellRectangle, int rowIndex, int colIndex, GridStyleInfo style)
>{
>	this.Model.ButtonBarSize =  new Size(this.Grid.Model.ColWidths[ColIndex]-4, this.Grid.Model.RowHeights[RowIndex]-4);
>
>	base.Draw (g, cellRectangle, rowIndex, colIndex, style);
>}
>


AD Administrator Syncfusion Team May 12, 2005 01:58 AM UTC

Do you have any style setting for style.ShowButtons? Can you upload a sample project showing the problem, or can you tell us how to see it in our sample?


AD Administrator Syncfusion Team May 12, 2005 02:51 PM UTC

Clay, I had already set the property style.ShowButtons to "Show". I changed it back to "None", did a rebuild, and then changed it back to "Show" and rebuilt again and now the buttons show up fine. Thanks a lot, >Do you have any style setting for style.ShowButtons? > >Can you upload a sample project showing the problem, or can you tell us how to see it in our sample?

Loader.
Live Chat Icon For mobile
Up arrow icon