Alex Feinman Datagrid Binder Class

  • Thread starter Thread starter Juan Santander
  • Start date Start date
J

Juan Santander

Alex,
I'm using your binder control found on
"http://www.alexfeinman.com/samples.asp", to change the forecolor of
selected rows on a datagrid. Now I need to be able to change the
backcolor of the datagrid based upon a condition.
I've tried modificating your Binder class, to control the
"m_CellBackColor" field of the datagrid (a SolidBrush), on the GetValue
method. This does paint some cells, but it has an undesired behavior.
It paints all the selected row always starting by the second cell, and
it paints also the first cell of the next row.
I'm stating the instruction to paint the row, just after the one that
changes the color of the text, and this last one works OK, but the
first one does not.
I'm using the following statement:
m_renderer.GetType().GetField("m_brushCellBack",
BindingFlags.NonPublic|BindingFlags.Instance).SetValue(m_renderer, new
SolidBrush(Color.Violet) );

Also tried this one:
br = (SolidBrush) m_renderer.GetType().GetField("m_brushCellBack",
BindingFlags.NonPublic|BindingFlags.Instance).GetValue(m_renderer);
br.Color = Color.Violet;

I would really appreciate your help, I just need to highlight a whole
row (by changing its backcolor) depending on a condition found on one
of its columns.

Thank you very much.

Juan C. Santander P.
 
Alex,
I'm really thankfull for your help, this problem has been a big head
ache for me for quite a long time.
I took your example "DataGridEvenOddRows", and modified it to meet my
needs.
Again, thank you very much for your help.

Juan Santander
 
Hello Alex,
I was wondering if you may have a Windows version of this binder. I was
trying to adapt the current component to work with a Windows DataGrid
but I'm getting some errors.
Thanks beforehand for your help.
Regards,

Juan Santander
 
No, not possible. This binder used internal implementation details of the CF
DataGrid, which are totally different on the desktop. OTOH you don't need in
on the desktop. You have Format and Parse events
 
Thank you Alex, but I cannot figure out how to use those events on the
Binding class to format a cell. Will it be necessary to create a custom
TextBoxColumn ?, is there an easy way to change backcolor for the whole
row instead changing it for one column at a time?
Thanks again,

Juan Santander
 
Back
Top