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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid style problems

Thread ID:

Created:

Updated:

Platform:

Replies:

4121 Apr 29,2003 06:23 PM UTC Apr 30,2003 04:21 PM UTC Windows Forms 4
loading
Tags: GridControl
Olivier Choquette
Asked On April 29, 2003 06:23 PM UTC

I want to define the following custom styles : -SelectedRow : style to apply on the currently selected row -SelectedCell : style to apply to the currently selected cell -Alternating : style to apply to the alternating "block" of rows (ex: make "blocks" of rows by changing the background colors, like in some spreadsheet) The Alternating style would be applied to the RowStyle in the GridControl.OnQueryCellInfo method as each qualifing row becomes visible. The SelectedRow and SelectedCell style would be applied on the Row style and cell style respectively in the GridControl.OnCurrentCellActivating method. first of all, i'm having trouble creating GridInfoStyle objects because there are no public constructors and the static GridInfoSTyle.Empty seems to always return the same Instance. Second, i've tried to use the GridInfoStyle.ModifyStyle method with mixed results (eratic behavior ending a big red X apprearing in the GridControl). I've also tried setting the styles as BaseStyles using GridControl.BaseStyleMap["..."] which seems to create a BaseStyle object when the specified key is not in the collection. To summarise, i need to be able to somehow merge a custom style with the row or cell style and be able to revert back to the original style once the row/cell is deactivated. Does anyone know how i could do this? Olivier

Administrator [Syncfusion]
Replied On April 29, 2003 08:02 PM UTC

You can create a style with code like: GridStyleInfo selectedRowStyle = new GridStyleInfo(); selectedRowStyle.BackColor = Color.LightBlue; The first comment is that all the style's you want to set could be done in QueryCellInfo or PrepareViewStyleInfo just like you mentioned that the alternating colors would be set.

Olivier Choquette
Replied On April 30, 2003 10:24 AM UTC

Ok, i can create the GridStyleInfo object (i don't know what's the version of my documentation, but there is no documented constructor for that object). When i modify the RowStyle of the currently selected cell in the OnQueryCellInfo, the changes don't seem to be refreshed immediately (have to minimise and maximise the window for example). Olivier

Administrator [Syncfusion]
Replied On April 30, 2003 12:59 PM UTC

> When i modify the RowStyle of the currently selected cell in the OnQueryCellInfo, the changes don't seem to be refreshed immediately (have to minimise and maximise the window for example). > Try also setting grid.Model.Options.RefreshCurrentCellBehavior = GridRefreshCurrentCellBehavior.RefreshRow This will force the grid to repaint the complete row when you move the current cell from one row to another. If you continue you to have problems, just attach a small sample project and we can check what you might do wrong. Stefan

Olivier Choquette
Replied On April 30, 2003 04:21 PM UTC

Setting the RefreshCurrentCellBehavior solved the refresh problem and i moved all the style modification stuff in the PreprareViewStyleInfo and it seems to work. thanks! Olivier

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

;