Version

PreferredWidth Property (TableCellSettings)

Gets/sets the preferred width of the cell
Syntax
'Declaration
 
Public Property PreferredWidth As Nullable(Of TableExtent)
public Nullable<TableExtent> PreferredWidth {get; set;}
Remarks

For this property, if the TableExtent.UnitType is 'Percent' it is a % of the overall width of the table. In this case, if the table’s preferred width is auto, the size of the table will be calculated based on the relative % values of each cell column coupled with each cell’s minimum width constraint (based on its content). Also note that the aggregate percentage value for all the columns’ preferred widths does not have to add up to 100. These values are treated more like relative weighting values. In other words in a 3 column table % values of 1-2-1 would result in the same layout as % values of 25-50-25 or 40-80-40 etc.

Note: the TableExtent.UnitType of TableRowSettings.LeadingEmptyAreaPreferredWidth and TableRowSettings.TrailingEmptyAreaPreferredWidth must be consistent for all TableRowNodes in the table and well as the UnitType of TableCellNode.TableCellNode.Settings.PreferredWidth for all cells in the table. For example, if any of the unit types are set to 'Percent' they all must be set to 'Percent' or 'Auto'. Likewise, if they are set to 'Twip' they all must be set to 'Twip' or 'Auto'. If 'Percent' and 'Twip' settings are mixed then the first one encountered will take precedence and be used for all.

Note: a type converter is supplied to allow this structure to be specified in xaml. Here are some sample values, in quotes, along with corresponding c# code examples:

  • "none" - new TableExtent(0d, TableExtentUnitType.None)
  • "auto" - new TableExtent(0d, TableExtentUnitType.Auto)
  • "2 auto" - new TableExtent(0d, TableExtentUnitType.Auto)
  • "25.8" - new TableExtent(25.8d, TableExtentUnitType.Twip)
  • "53.8%" - new TableExtent(53.8d, TableExtentUnitType.Percent)

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also