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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





33706 Aug 24,2005 03:10 PM UTC Aug 25,2005 12:48 PM UTC WinForms 2
Tags: GridControl
Administrator [Syncfusion]
Asked On August 24, 2005 03:10 PM UTC

Hello, I''m trying to replace view of Expand cell button of GridDataBoundGrid with my own images for collapsed/expanded states. I created my own ExpandCellModel (descendant of GridDataBoundRowExpandCellModel) which uses ExpandCellRenderer (descendant of GridDataBoundRowExpandCellRenderer) that again uses ExpandButton( descendant of GridDataBoundRowExpandCellButton). In ExpandButton class method Draw is overrided: public override void Draw(Graphics g, int rowIndex, int colIndex, bool bActive, GridStyleInfo style) { Bitmap image = expanded ? _expanded :_collapsed; g.DrawImage(image, Bounds.Left, Bounds.Top); } added in constructor of the grid this.Model.CellModels.Add("ExpandCellModel", new CustomGridCell.ExpandCellModel(this.Model)); and in handler of GridDataBoundGrid.PrepareViewStyleInfo for cell with appropriate number of column e.Style.CellType = "ExpandCellModel"; but method ExpandButton.Draw is never executed, and expand button stays same, no my images are presented. Can you suggest something? Thank you

Administrator [Syncfusion]
Replied On August 24, 2005 04:36 PM UTC

In the constructor of your renderer class, I think you will have to remove the button (there is a protected renderer.RemoveButton method) that was added in the base class constructor and then add an instance of your own button. I suspect it is this baseclass button still being used is the reason you do not see your code being hit.

Administrator [Syncfusion]
Replied On August 25, 2005 12:48 PM UTC

Yes, that is working, thank you very much. I''ve also discovered that button remembers it state only when current cell is avctive: I used functions IsPushed and IsMouseDown to determine state of the button in the Draw method. As I see own Expand buttons of GridDataBoundGrid remembers their state - they store it in GridStyleInfo.CellValue. So now I do the same - and my custom Expand button works good. Thank you again.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon