Hello,
Q1 2009 Winform controls.
I am having a little trouble with wrapping text and autosizing rows. I have a gridview on a form with a checkbox at the top to define whether to show the full cell text or not.
As far as wrapping text and the rows autosizing, I cannot even get this to work correctly. The problems are:
1..Wrapping of text and resizing of rows only seems to work correctly if the line this.radGridViewExceptions.MasterGridViewTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; is not commented out. If this is commented out and I set the column widths in the swtich, the description column, which has the most text, only shows 2 lines of text fully. The 3rd and final line in that cell shows about 10% of the top of the 3rd line, the rest is cut off.
2..The cursor changes to an arrow pointing up and down, like it is going to let me resize the row, but I cannot resize it even though AllowResize is set to true in the designer properties
3...My functional requirement is that on clicking the checkbox to not show full text, the rows go back to only show one line of text and do not wrap. So in the event handler for the checkbox I go through the columns in the grid and set WrapText to the checked state of the checkbox. This either enables or disables wrapping ok, but the row height when going from wraptext =true to wraptext = false does not change so I am left with thick and thin rows. I want all rows to be thin, ie all the same height.
Thanks in advance,
My code is below:
Q1 2009 Winform controls.
I am having a little trouble with wrapping text and autosizing rows. I have a gridview on a form with a checkbox at the top to define whether to show the full cell text or not.
As far as wrapping text and the rows autosizing, I cannot even get this to work correctly. The problems are:
1..Wrapping of text and resizing of rows only seems to work correctly if the line this.radGridViewExceptions.MasterGridViewTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; is not commented out. If this is commented out and I set the column widths in the swtich, the description column, which has the most text, only shows 2 lines of text fully. The 3rd and final line in that cell shows about 10% of the top of the 3rd line, the rest is cut off.
2..The cursor changes to an arrow pointing up and down, like it is going to let me resize the row, but I cannot resize it even though AllowResize is set to true in the designer properties
3...My functional requirement is that on clicking the checkbox to not show full text, the rows go back to only show one line of text and do not wrap. So in the event handler for the checkbox I go through the columns in the grid and set WrapText to the checked state of the checkbox. This either enables or disables wrapping ok, but the row height when going from wraptext =true to wraptext = false does not change so I am left with thick and thin rows. I want all rows to be thin, ie all the same height.
Thanks in advance,
My code is below:
private void SetupForm() |
{ |
try |
{ |
// Add the events |
this.radGridViewExceptions.ViewCellFormatting += new Telerik.WinControls.UI.CellFormattingEventHandler(radGridViewExceptions_ViewCellFormatting); |
this.radGridViewExceptions.DataSource = m_objExceptions.GetLast30DaysExceptions(); |
// Wrapping text only seems to work correctly if this is not commented out // and I do not set the column widths below // this.radGridViewExceptions.MasterGridViewTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill; |
this.radGridViewExceptions.MasterGridViewTemplate.AllowColumnReorder = false; |
this.radGridViewExceptions.MasterGridViewTemplate.AllowColumnResize = false; |
this.radGridViewExceptions.AutoSizeRows = true; |
// Format the columns |
foreach (GridViewColumn column in radGridViewExceptions.Columns) |
{ |
switch (column.HeaderText) |
{ |
case "When_Occured": |
case "Description": |
column.Width = 200; |
break; |
case "App_Assembly": |
column.Width = 120; |
break; |
case "App_Assembly_Version": |
column.Width = 150; |
break; |
default: |
column.Width = 100; |
break; |
} |
column.WrapText = true; //radCheckBoxShowFullText.Checked; |
} |
m_bFormLoaded = true; |
} |
catch (Exception ex) |
{ |
ShowException(ex); |
m_bFormLoaded = false; |
} |
} |