Formatting Datagrid column?????

E

Eashwar

Hi:
I have added a DataGridColumnStyle and have set the alignment to
Right-Justify. But the header text is also right-justified, which I
don't want it to. Is there a method I could prevent so that the header
text is aligned center while the column values for that column are
right-justified.

Thanks.
Ambarish
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi Ambarish,

I feel your pain as I was in a similar situation. Unfortunately, column
header appearance cannot be customized without overriding the whole grid
painting routine. While cell contents is painted by DataGridColumnStyle
derivatives themselves, column headers are painted by the DataGrid control
itself and there seems to be no overridable method or an event which would
be "responsible" for painting headers.

Please don't take my words as an "absolute truth" though as there still may
be a way to do that, and I will also be glad to find out if one exists.
 
E

Eashwar

Hi Dimitry,
Thanks for the info. its really frustrating that you have limited
control on the windows forms datagrid control when it comes to
customizing than the web form control.

thanks.
Ambarish
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,
Thanks for the info. its really frustrating that you have limited
control on the windows forms datagrid control when it comes to

Umm.. probably I am just don't getting you right but I just couldn't limit
anything with the DataGrid control as I have never been a Microsoft employee
:)

As a matter of fact, Microsoft has promised to upgrade the DataGrid control
with (if my memory serves me well) the Whidbey release of Visual Studio .NET
planned for 2004.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software

Hi Dimitry,
Thanks for the info. its really frustrating that you have limited
control on the windows forms datagrid control when it comes to
customizing than the web form control.

thanks.
Ambarish
"Dmitriy Lapshin [C# / .NET MVP]" <[email protected]> wrote
in message news: said:
Hi Ambarish,

I feel your pain as I was in a similar situation. Unfortunately, column
header appearance cannot be customized without overriding the whole grid
painting routine. While cell contents is painted by DataGridColumnStyle
derivatives themselves, column headers are painted by the DataGrid control
itself and there seems to be no overridable method or an event which would
be "responsible" for painting headers.

Please don't take my words as an "absolute truth" though as there still may
be a way to do that, and I will also be glad to find out if one exists.

--
Dmitriy Lapshin
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top