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

Row Lineheight with Metro Style

1 Answer 45 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 27 Sep 2012, 10:40 AM
Hello Support,

Please see a snippet of a grid that I'm developing using the metro style. However my column called Marketing Notes has some text that is split with CRLF and because the row height is quite large on the metro style it tries to fit both lines of text in. I'd ideally not want to adjust the row height and get the column to behave in a single line text format.

The properties to set up the grid column are:-
t_frmMain.RadGridView_TargetCos.Columns("MarketingNotes").HeaderText = "Marketing Notes"
t_frmMain.RadGridView_TargetCos.Columns("MarketingNotes").HeaderTextAlignment = ContentAlignment.MiddleLeft
t_frmMain.RadGridView_TargetCos.Columns("MarketingNotes").TextAlignment = ContentAlignment.MiddleLeft
t_frmMain.RadGridView_TargetCos.Columns("MarketingNotes").Width = 200


Is this possible?

Thanks

Terry

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 29 Sep 2012, 09:24 AM
Hi Terry,

Thank you for writing.

You can achieve the desired look by removing the new line characters from your string in the CellFormatting event handler:
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.Column.Name == "YourColumnName")
    {
        e.CellElement.Text = e.CellElement.Text.Replace(Environment.NewLine, " ");
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.TextProperty, Telerik.WinControls.ValueResetFlags.Local);
    }
}

I hope this helps.
 
Greetings,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Terry
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or