开发者

Why doesn't Flowdocument's tooltip show?

开发者 https://www.devze.com 2023-04-06 09:01 出处:网络
I have a very strange problem with tooltips inside FlowDocument. Finally I am able to narrow it down to the following xaml. Paste the following xaml into kaxaml or Blend, you will see the problem.

I have a very strange problem with tooltips inside FlowDocument. Finally I am able to narrow it down to the following xaml. Paste the following xaml into kaxaml or Blend, you will see the problem.

<FlowDocumentScrollViewer>
    <FlowDocument Background="Transparent">
        <Table>
            <Table.Columns>
                <TableColumn Width="15" />
      开发者_如何转开发          <TableColumn />
            </Table.Columns>
            <TableRowGroup>
                <TableRow>
                    <TableCell>
                        <Paragraph Margin="0,3.10333333333333,0,0">
                            <Run FontSize="5">●</Run>
                        </Paragraph>
                    </TableCell>
                    <TableCell>
                        <Paragraph>
                            <Run FontSize="13"
                                 ToolTip="This is a tooltip">I have a tooltip</Run>
                        </Paragraph>
                        <Paragraph LineHeight="0.1"
                                   Background="Transparent">
                            <Figure Name="MyFigure"
                                    HorizontalAnchor="ColumnLeft"
                                    VerticalAnchor="ParagraphTop"
                                    CanDelayPlacement="False"
                                    Width="200"
                                    Padding="0,0,0,0">
                                <BlockUIContainer>
                                    <Grid>
                                        <Rectangle Name="MyRectangle"
                                                   Fill="Green"
                                                   Width="Auto"
                                                   Height="50" />
                                    </Grid>
                                </BlockUIContainer>
                            </Figure>
                        </Paragraph>
                    </TableCell>
                </TableRow>
            </TableRowGroup>
        </Table>
    </FlowDocument>
</FlowDocumentScrollViewer>

The tooltip doesn't open. However if I do one of the following, the tooltip will show.

  • Change MyFigure's Width to 15
  • Change MyRectangle's Height to 5

It almost feels like the Run is covered by something so its tooltip doesn't show.


Try to set IsDocumentEnabled="True" on FlowDocument.

Edit: IsDocumentEnabled property is on the RichTextBox and won't help in this case to make tooltip work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号