New to Telerik UI for Silverlight? Download free 30-day trial

Properties

Property Description
LayoutMode Gets or sets the table layout mode.
PreferredWidth Gets or sets the preferred width of the table.
FlowDirection Gets or sets the flow direction of the table contents.
CellPadding Gets or sets the cell padding.
Background Gets or sets the table background.
TableIndent Gets or sets the table indent.
CellSpacing Gets or sets the cell spacing.

Example 1: Set Table Properties

Table table = new Table(); 
table.LayoutMode = TableLayoutMode.AutoFit; 
table.CellPadding = new Telerik.Windows.Documents.Layout.Padding(5); 
table.CellSpacing = 10; 
Dim table As New Table() 
table.LayoutMode = TableLayoutMode.AutoFit 
table.CellPadding = New Telerik.Windows.Documents.Layout.Padding(5) 
table.CellSpacing = 10 

Methods for adding or Inserting Rows

Method Description
AddRow Adds copy of the last TableRow in the table.
AddRowAbove(TableRow existingRow) Copies a specified TableRow and adds the copy above it.
AddRowAtIndex Adds a TableRow at a specific index.
AddRowBelow(TableRow existingRow) Copies a specified Telerik.Windows.Documents.Model.TableRow and adds the copy below it.
DeleteRow(TableRow row) Deletes a TableRow.

Example 2: Add Rows

Table table = new Table(); 
 
var row = table.AddRow(); 
var row2 = table.AddRowAtIndex(5); 
Dim table As New Table() 
 
Dim row = table.AddRow() 
Dim row2 = table.AddRowAtIndex(5) 

Inserting and Deleting a Table

Method Description
DeleteTable Deletes the currently selected table.
DeleteTableColumn Deletes the currently selected column.
DeleteTableRow Deletes the currently selected row.
InsertTable Inserts a table. Allows you to specify the number of rows and columns. Has an overload that allows you to specify if a Paragraph should be inserted before the table.
InsertTableColumn Inserts a column at the end of the table.
InsertTableColumnToTheLeft Inserts a column to the left of the selected one.
InsertTableColumnToTheRight Inserts a column to the right of the selected one.
InsertTableRow Inserts a row at the end of the table.
InsertTableRowAbove Inserts a row above the selected one.
InsertTableRowBelow Inserts a row below the selected one.

Example 3: Add or Delete Table

radRichTextBox.DeleteTable(); 
radRichTextBox.InsertTable(table); 
radRichTextBox.DeleteTable() 
radRichTextBox.InsertTable(table) 

Methods for Formatting Tables

Method Description
ChangeTableBorders Modifies the borders of the currently selected table via a TableBorders object.
ChangeTableCellBackground Sets the background color of the currently selected cell.
ChangeTableCellBorders Modifies the borders of the currently selected table via a TableCellBorders or a Border object.
ChangeTableCellSpacing Modifies the spacing between the cells.
ChangeTableCellContentAlignment Modifies the horizontal and vertical content alignment of the currently selected cell.
ChangeTableCellVerticalContentAlignment Modifies the vertical alignment of the currently selected cell.
ChangeTableCellHorizontalContentAlignment Modifies the horizontal alignment of the currently selected cell.
ChangeTableCellPadding Modifies the padding of the currently selected cell.
ChangeTableDefaultCellPadding Modifies the default cell padding of the currently selected table.
ChangeTableLayoutMode Modifies the layout mode of a table.
ChangeTableHorizontalAlignment Modifies the horizontal alignment of the currently selected table.
ChangeTableGridColumnWidth Modifies the width of the column with the specified zero-based index.
ChangeTableRowHeight Changes the height of a table row.
MergeTableCells Merges the currently selected cells.
UnmergeTableCells Splits the currently selected table cell if it has been merged.

In versions earlier than Q1 2015 before and after each Table element is inserted a Paragraph. When the Table is inserted via the UI or the InsertTable() method this is done automatically, otherwise paragraphs should be inserted manually. In next versions the Paragraph before the Table is not mandatory.

Example 4: Change Existing Table Properties

radRichTextBox.UnmergeTableCells(); 
radRichTextBox.ChangeTableLayoutMode(table, TableLayoutMode.AutoFit); 
radRichTextBox.UnmergeTableCells() 
radRichTextBox.ChangeTableLayoutMode(table, TableLayoutMode.AutoFit) 
In this article
Not finding the help you need? Improve this article