This is a migrated thread and some comments may be shown as answers.

Multiline Header

5 Answers 869 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Zbyslaw Kanik
Top achievements
Rank 1
Zbyslaw Kanik asked on 06 Jan 2010, 04:26 PM
Hi,
Is possible to have multiline grid header when using text in compatibile rendering mode?
Or is some asy way to remove antialiasing from text in grid when is in compatibile mode?

Best Regards
Rafal

5 Answers, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 11 Jan 2010, 09:11 AM
Hi Rafal Dabrowa,

You can not change the anti-aliasing of the text in grid, because you can not do it for the basic visual element of TPF. We have addressed this feature request in the next major release Q1 2010. In the meantime, you may change the text anti-aliasing mode of the current operation system. This will affect the text rendering mode in the Telerik Controls.

Regarding the multiline text in the header, you can set WrapText property of the header cells to true. After that, you should specify the width of the columns. Then your text will be arranged on one or more lines depending on its length. Here is the sample how you should do it:

this.radGridView1.DataSource = dtSource;
 
GridTableHeaderRowElement tableHeaderRow = this.radGridView1.GridElement.FindDescendant<GridTableHeaderRowElement>();
 
foreach (GridCellElement cellElement in tableHeaderRow.Children)
{
    if (cellElement is GridHeaderCellElement)
    {
        cellElement.TextWrap = true;
    }
}
this.radGridView1.Columns["ID"].HeaderText = "The is a long long text";
this.radGridView1.Columns["ID"].Width = 100;

If you have further questions, feel free to ask.

Regards,
Svett
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Zbyslaw Kanik
Top achievements
Rank 1
answered on 15 Jan 2010, 08:59 AM
Hi
Thank You. but try this

if (cellElement is GridHeaderCellElement)
    {
        cellElement.TextWrap = true;
    }

we havent TextWrap property

Regards
0
Svett
Telerik team
answered on 15 Jan 2010, 03:03 PM
Hi Rafal Dabrowa,

I apologize for my previous answer. It was based on the current development version which will be shipped in the next major release. You should set WrapText property of the column to true and AutoSizeRows property of the grid to true.

this.radGridView.AutoSizeRows = true;
this.radGridView.Columns[1].WrapText = true;
this.radGridView.Columns[1].HeaderText = "This is a long long text";

Let me know if you need further assistance.

Greetings,
Svett
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Imran Khalid
Top achievements
Rank 1
answered on 03 May 2010, 08:57 PM
If i just want to add the multiline to the header text only  but not the columns data itself.
I hope to configure these settings at design time.
or the only way to do it is via writing code ?
I am using Q1/2010 SP1.

thanks
0
Svett
Telerik team
answered on 04 May 2010, 06:33 PM
Hello Imran Khalid,

Presently, you cannot do that design time. You can wrap the text of header cells by setting their TextWrap property to true. Also you have to enable clipping by setting ClipDrawing property to true. You need to do that in ViewCellFormatting event. You can use the following code snippet:

this.radGridView.ViewCellFormatting += new CellFormattingEventHandler(radGridView_ViewCellFormatting);
this.radGridView.AutoSizeRows = true;

private void radGridView_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement is GridHeaderCellElement)
    {
        e.CellElement.TextWrap = true;
        e.CellElement.ClipDrawing = true;
    }
}

Regards,
Svett
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Zbyslaw Kanik
Top achievements
Rank 1
Answers by
Svett
Telerik team
Zbyslaw Kanik
Top achievements
Rank 1
Imran Khalid
Top achievements
Rank 1
Share this question
or