this is a general question with a few different parts:
1) Is it possible to derive a custom class from GridStyleInfo that can be used to set the style of a GridBoundColumn?
2) Is it possible to specify an edit control for a grid cell that is neither a SyncFusion control nor a Windows.Forms base class? If it is possible, what are the requirements for the control class - for example, to work in place of a GridListControl, does the other control need to descend from System.Windows.Forms.ListControl?
3) Is there an event, or a point in the design process, where the developer has access to the properties of a cell's edit control? I'm thinking of something like the ShowColumnHeader property for a GridListControl in a grid cell. This isn't accessible via the renderer class or the style. If you wanted to suppress column headers in all dropdowns in a grid, how would you do it?
Charles River Development
ADAdministrator Syncfusion Team June 2, 2003 09:21 AM
1) Deriving GridStyleInfo is difficult becuase of the staic constructors and members that it uses. It is pretty tricky, and you probably want to use some other technique to accomplish your goal.
If you want to have a specific style that is easily applied to other styles, you can create your own BaseStyle (either from the designer or through code). Then setting the gridBoundColumn.StyleInfo.BaseStyle equal to your custome basestyle will make the column use those style setting that you added to your basestyle.
Maybe using basestyles will let you accomplish what you need.
You could also derive GridBoundColumn, and set StyleInfo properties in its contructor if you like.
2)If you derive your custom cell from GridCellRendererBase and GridCellModelBase (or one of the other renderer/model pairs), you can try to use any control you like. But, it can be tricky, and you do have to fit into this renderer/model architecture that is used by all the 2 dozen or so cell controls that are included in our library or shipped in samples.
In teh user's guide, there is a CustomCell control tutorial that is a first pass at getting you going. The tricky parts start happening when you realize that the default behavior of teh grid is to use a single control and simply share it among all cells that use this control. This means that you have to save all the state information for you control on a per cell basis (usually in teh GridStyleInfo class), and then use this state information to initialze your control when it the grid tries to activate it. The virtual methods in the cellmodel and cellrenderer class are what lets this happen.
Version 1.6 does have a generic control cell that tries to make it easy to use windows forms controls. Maybe deriving form this cell control would be something to try to begin with.
3) After the grid has been initialized (say in formload), you can access the grid.CellRenderers collection or the grid.Model.CellModels collection to try to set properties. But if the property is something that will be reset when a cell becomes active, then you would have to catch some cell specific event such as CurrentCellShowingDropDown or CurrentCellStartEditing or CurrentCellControlGotFocus to try to set the property for a particular cell.
ETEric TanafonJune 2, 2003 09:36 AM
thanks very much for your quick responses.