views:

382

answers:

2

DevExpress GridControl control for WinForms supports BorderStyle property (through it's View), but it seems like it doesn't support BorderColor. Or am I wrong?

How can I set BorderColor property for GridControl borders?

A: 

You could always set BorderStyle to NoBorder and wrap the GridControl inside a PanelControl.

Set up the properties something like this:

gridControl1.MainView.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
panelControl1.LookAndFeel.UseDefaultLookAndFeel = false;
panelControl1.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
panelControl1.Appearance.BorderColor = Color.Red;
panelControl1.Appearance.Options.UseBorderColor = true;
panelControl1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
Manga Lee
What if you have, say, hundred of GridControl occurences throughout solution? Are you gonna wrap them all?
sh0gged
It is an alternative. You could make a method that would take a grid and a panel control and setup the properties as described above. Or you could make a UserControl. But then you probably would lose much of the design time features of the grid control which are very nice to have.
Manga Lee
Thanks. I just wanted to point out that this workaround is not an option in a little more serious scenario and, as you mentioned above, is a metter of compromises. :) That's why I'm sure it must be done through some of GridControl members. I think I'd better contact DevX support team to solve this issue.
sh0gged
A: 

Are you using skins? The skinning mechanism will most likely override your border color setting unless you disable them.

Brendon