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. Image for the cookie policy date

Style of a cell flickering

I am using GridControl.
I am setting 3 levels of styles.
1. The background style for the whole Grid range. This is done on Grid setup.
2. As I have a custom FilterBar in the first row I am setting a specific style for it as well. This is done on Grid setup.
3. The third style is the style of the specific cell that was just modified (or previously) by the user. This is done in QueryCellInfo like so:
CustomRowBarEventArgs args =
new CustomRowBarEventArgs(e.RowIndex, GetFieldIdFromColIndex(e.ColIndex),
column.CacheIndex, e.Style);
c.OnGridCustomRowBar(args);
e.Handled = true;

In the same handler I see and ignore requests for the style of the whole FilterBar row, as it seems redundant.

The problem that I see is that I see flicker between the RowStyle and CellStyle on each grid update (every half a second) in the cell of the FilterBar that already has a value and is being edited. Also, the cursor jumps between positions in the cell string.
It looks like I am missing something trivial like
BeginEditStyle
setStyle
EndEditStyle
type of thing...
Could you please point me into the right direction?

4 Replies

AD Administrator Syncfusion Team October 19, 2007 12:01 PM UTC

QueryCellInfo is raised several times for each cell.

When e.RowIndex and e.ColIndex are both -1, then the request is for the style associated with grid.TableStyle.

When e.RowIndex > 0 and e.ColIndex == 0, then the request is for the row style, grid.RowStyles[e.RowIndex].

When e.RowIndex == 0 and e.ColIndex > 0, the request is for grid.ColStyles[e.ColIndex].

It is only when both e.RowIndex and e.ColIndex are nonnegative that the grid is requesting the particular cell style. So, you may want only want to raise the event when the grid is requesting a cell style to see if that will avoid the problem you are seeing.


AO Alexei Ostrov October 19, 2007 02:50 PM UTC

Clay,
thank you very much for your answer.
I should have been clearer in what I am doing. As I said, I am ignoring the requests for row and column styles. In fact, I am ignoring anything other than my custom filter bar cells indexes.
After a bit more experimenting, I see that I see flicker even when I only set different style for my row like this:
...snip..
if (e.ColIndex < 0) // this is asking for dynamic style of the row whose index is passed
{
if (e.RowIndex == ((CustomRowBar)FilterBar).CustomRowIndex)
{
forDebugOnlySetFilterStyle(e.Style);
return;
}
}
...snip..

...snip..
private void forDebugOnlySetFilterStyle(GridStyleInfo style)
{
style.Font.Bold = false;
style.BackColor = Color.LightBlue;
style.TextColor = Color.Black;
style.CellType = GridCellTypeName.TextBox;
style.ReadOnly = false;
}
...snip..

As a side note, my grid is about 3500 rows by 10 columns (but this should not be the limit).
My group has inherited this grid and it is in pretty bad shape. I am pretty new to GridControl but intend to fix it up.

Thank you very much for your help.


AD Administrator Syncfusion Team October 19, 2007 04:12 PM UTC

You can try sandwiching this code that changes the style between

style.BeginInit();
//change code...
style.EndInit();

to see if this avoids the flicker.


AO Alexei Ostrov October 22, 2007 03:23 PM UTC

This was caused mostly by our own code. I achieved by locking CurrentCell.

Thank you for your help

Loader.
Live Chat Icon For mobile
Up arrow icon