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

Specifying absolute cell width in Table

5 Answers 164 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Aggie
Top achievements
Rank 1
Aggie asked on 12 Apr 2011, 05:36 AM
What is the correct way to programmatically specify a required width for a TableCell in a Table?
I'm trying:
cell.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Fixed, (float)120);
and:
cell.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, (float)20);
and:
cell.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, (float)0.2);
but neither has any effect on the resulting table where the columns are created too wide and don't fit into my document.

Also, is there any way to restrict the maximum width of a table row so that it always fits into the document and it's columns are spread evenly?

Help!

5 Answers, 1 is accepted

Sort by
0
Ivailo Karamanolev
Telerik team
answered on 15 Apr 2011, 08:03 AM
Hello Aggie,

The property you're currently using is the correct one, however, there are some details about it. First of all, the width conflict resolution policy is to use the width of the first cell in a column with an explicit one set. If you have other cells above the one you're modifying that have PreferredWidth set, those will be used.
Secondly, this gets even more complicated due to the fact that a cell can span more than one column.  To make these situations easier to manage, you have Table.Grid.Columns at your disposable where you can set the preferred widths on a per-column level.

Best wishes,
Ivailo
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
0
Ikhwan
Top achievements
Rank 1
answered on 25 May 2011, 12:42 PM
When you say its easier to set width using Table.Grid, how is this been done?
0
Ivailo Karamanolev
Telerik team
answered on 31 May 2011, 08:30 AM
Hi Ikhwan,

Please refer to your support ticket with ID 422542 for an answer with the appropriate demo.
Let us know if you need any further assistance.

Regards,
Ivailo
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
0
Ikhwan
Top achievements
Rank 1
answered on 03 Jun 2011, 01:08 PM
I've seen the demo / project file you gave me but that is for the same width for each column. I need an example that involves ColumnSpan and different width for each column. 
0
Iva Toteva
Telerik team
answered on 07 Jun 2011, 05:54 PM
Hello Ikhwan,

You can find another demo attached in the support ticket Ivailo cited. If you have other comments, please share them in the ticket thread and we will do our best to address them as soon as possible.

Best wishes,
Iva
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
RichTextBox
Asked by
Aggie
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Ikhwan
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or