Is there any way to align the content of a TableCell
to the bottom? I thought this was easy, but obviously, it is not.
The situation:
Inside a FlowDocument
I have the following (simplified) Table
:
<Table>
<Table.Columns>
<TableColumn Width="Auto"/>
<TableColumn Width="Auto"/>
<TableColumn Width="Auto"/>
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell>
<BlockUIContainer>
<Image Source="{Binding to an image}"/>
</BlockUIContainer>
</TableCell>
<TableCell containing something else/>
<TableCell>
<BlockUIContainer>
<Image Source="{Binding to another image}"/>
</BlockUIContainer>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
The two images do not have the same height so there is some empty space below the smaller of them.
What I want:
Instead, I want the empty space above the smaller image (i.e. the images aligned to the bottom of the TableRow
).
What I tried:
I tried to find a VerticalAlignment
property to change the alignment. However, there is no VerticalAlignment
property in BlockUIContainer
, TableCell
or TableRow
.
Also, I tried replacing the BlockUIContainer
by an InlineUIContainer
and setting its BaselineAlignment
. However, to do this, I had to wrap it into a Paragraph
like so:
<TableCell>
<Paragraph>
<InlineUIContainer BaselineAlignment="Bottom">
<Image Source="{Binding to an image}"/>
</InlineUIContainer>
</Paragraph>
</TableCell>
Now I have an image aligned to the bottom of a Paragraph
which is aligned to the top of the TableCell
and only as high as required for the Image
. So it looks exactly as it did before.