为什么 Flowdocument 的工具提示不显示?
我对 FlowDocument 内的工具提示有一个非常奇怪的问题。最后我能够将其范围缩小到以下 xaml。将以下xaml粘贴到kaxaml或Blend中,您将看到问题。
<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>
工具提示打不开。但是,如果我执行以下操作之一,则会显示工具提示。
- 将 MyFigure 的宽度更改为 15
- 将 MyRectangle 的高度更改为 5
几乎感觉 Run 被某些东西覆盖,因此其工具提示不显示。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在
FlowDocument上设置IsDocumentEnabled="True"
。编辑: IsDocumentEnabled 属性位于 RichTextBox 上,在这种情况下不会帮助使工具提示正常工作。
Try to set
IsDocumentEnabled="True"
onFlowDocument.Edit: IsDocumentEnabled property is on the RichTextBox and won't help in this case to make tooltip work.