How can I vertically align a TableCell (or its contents) with a FlowDocument

Is there a way to align the content TableCellto the end? I thought it was easy, but obviously it is not.

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>

Two images do not have the same height, so below the smaller of them less.

What I want:

Instead, I want the empty space above the smaller image (i.e. the images are aligned at the bottom TableRow).

What I tried:

I tried to find a property VerticalAlignmentto change the alignment. However, in BlockUIContainer, TableCellor TableRownot properties VerticalAlignment.

, BlockUIContainer InlineUIContainer BaselineAlignment. Paragraph :

<TableCell>
    <Paragraph>
        <InlineUIContainer BaselineAlignment="Bottom">
            <Image Source="{Binding to an image}"/>
        </InlineUIContainer>
    </Paragraph>
</TableCell>

, Paragraph, TableCell , Image. , , .

+4
1

- . , . . ...

    <Table>
        <TableRowGroup>
            <TableRow>
                <TableCell>
                    <BlockUIContainer>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Image Grid.Column="0" Source="Images/globe.png" Height="10" Width="10" VerticalAlignment="Bottom"/>
                            <TextBlock Grid.Column="1" TextWrapping="Wrap">This is something else</TextBlock>
                            <Image Grid.Column="2" Source="Images/globe.png" Height="20" Width="20" VerticalAlignment="Bottom"/>
                        </Grid>
                    </BlockUIContainer>
                </TableCell>
            </TableRow>
        </TableRowGroup>
    </Table>
+2

Source: https://habr.com/ru/post/1663837/


All Articles