I want a table to logically size the columns according to the contents. Is this possible in WPF?
alt text http://img43.imageshack.us/img43/2640/flowdocument.jpg
Actually, Microsoft recommends to use a Grid instead of table for this purpose: docs.microsoft.com: Table vs Grid
Alas, Grid does not support simple grid lines out of the box. Microsoft says the Grid.ShowGridLines
is only for design purposes and draws rather ugly dashed lines. Micrsoft wants you to draw Gridlines yourself. How lazy is that from Microsoft ?
Here is some sample code how this can be done:
The main idea is to set each TextBox inside a Border and to decide for each Border which side needs a borderline.
To get precise 1 pixel line, one must set Grid.RenderOptions.EdgeMode="Aliased"
and Grid.UseLayoutRounding="True"
.