<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication1.Window1"
Title="Add Content to a Table">
<FlowDocumentScrollViewer HorizontalAlignment="Left" VerticalAlignment="Top">
<FlowDocument>
<Paragraph>
<Button Canvas.Left="5" Click="AddRow">Add a New TableRow to the Table</Button>
</Paragraph>
<Table CellSpacing="5" Name="table1">
<Table.Columns>
<TableColumn/>
</Table.Columns>
<TableRowGroup Name="trg1">
<TableRow>
<TableCell>
<Paragraph FontSize="14pt">TableRow</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
</FlowDocumentScrollViewer>
</Window>
//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
namespace WpfApplication1
{
public partial class Window1 : Window
{
publicvoid AddRow(object sender, RoutedEventArgs e)
{
TableRow row = new TableRow();
trg1.Rows.Add(row);
Paragraph para = new Paragraph();
para.Inlines.Add("A new Row and Cell have been Added to the Table");
TableCell cell = new TableCell(para);
row.Cells.Add(cell);
}
}
}