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.

OnPrepareViewStyleInfo vs OnQueryCellInfo

Thread ID:

Created:

Updated:

Platform:

Replies:

69367 Oct 25,2007 09:18 AM Oct 25,2007 08:29 PM Windows Forms 1
loading
Tags: GridControl
Juan Diego Quesada Ocampo
Asked On October 25, 2007 09:18 AM

Hi,

I am using the GC using the virtual architecture and setting some custom formatting and coloring for individual cells. Hence I had to override both event handlers. Now I have clear from other forums and my experience that you should set the values and the style of the cell in OnQueryCellInfo and the coloring such as e.Style.TextColor and e.Style.BackColor in OnPrepareViewStyleInfo.
However I feel there is this grey region of properties which I do not know where it is the correct place to be taken care of such as:
cellStyleInfo.CellValueType, cellStyleInfo.Format, gridStyleInfo.Font.Bold, gridStyleInfo.Font.
A tutorial explaining the correct use of the architecture involving these two similar events will be highly appreciated, I read in the forum how confused many other people are over this.

Thanks in advance

J.Nagarajan [Syncfusion]
Replied On October 25, 2007 08:29 PM

Hi Quesada ,

PrepareViewStyleInfo is generally used to modify style properties immediately before the style is used to draw the cell. So, if you have a property setting that is transient in that it dynamcailly changes and is only needed for drawing (like the backcolor depending upon the cellvalue), then PrepareViewStyleInfo is the place to do this work.

QueryCellInfo is hit anytime the grid needs a cell style for any reason. So QueryCellInfo is hit prior to PrepareViewStyleInfo, and may be hit for other reasons than preparing the style for drawing. If you use code like grid[row, col], then QueryCellInfo is hit, but PrepareViewStyleInfo may not hit. So, if you are setting a style property that may be of use to you for something other than be drawn a certain way, then you should use QueryCellInfo to set the property dynamically.

Regards,
Nagaraj

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.

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.

;