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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Controls/styles associated with grid cells

Thread ID:

Created:

Updated:

Platform:

Replies:

4803 Jun 2,2003 01:02 PM UTC Jun 2,2003 02:36 PM UTC WinForms 2
loading
Tags: GridControl
Eric Tanafon
Asked On June 2, 2003 01:02 PM UTC

Hello, 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? Thanks, Eric Tanafon Charles River Development

Administrator [Syncfusion]
Replied On June 2, 2003 02:21 PM UTC

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.

Eric Tanafon
Replied On June 2, 2003 02:36 PM UTC

Clay, thanks very much for your quick responses. Eric

CONFIRMATION

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.

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

;