datagrid selectionbackcolor

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a datagrid and am trying to set it's selectionbackcolor, and though
all the other things work, this and the selectionforecolor don't. Any idea
why? Also, I have the cells set to read-only, but don't like how the text is
highlighted (blue), making it look as if you could change it. Is there a way
to set it so that just the background changes color?
Thanks,
Mel

DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = "Catalog";
ts.BackColor = Color.Black;
ts.ForeColor = Color.LightGray;
ts.HeaderBackColor = Color.Black;
ts.HeaderForeColor = Color.DarkKhaki;
ts.HeaderFont = fontsmall16;
ts.AlternatingBackColor = Color.Black;
ts.GridLineStyle = DataGridLineStyle.None;
ts.ReadOnly = true;
ts.RowHeadersVisible = false;
ts.AllowSorting = true;
ts.SelectionBackColor = Color.Black;
ts.SelectionForeColor = Color.Red;
 
I use thrid party datagrid. This is how do it, may be it is same for
datagrid as well

GridRow dr = //selected row
dr.Appearance.ForeColor = SystemColors.GrayText;
dr.Appearance.BackColor = Color.FromArgb(0xF0,0xF0,0xF0);

this gray out the selected row.
 
//dr is the selected row from the datagrid
dr.Appearance.ForeColor = SystemColors.GrayText;
dr.Appearance.BackColor = Color.FromArgb(0xF0,0xF0,0xF0);

this changes the row to gray.
[My previous post didn't come, so if you see double post sorry]
 
Back
Top