Ramin Ramin - 1 year ago 89
C# Question

How to Show the Tooltip of a TableCell in a RichTextBox

I insert a Table in a RichTextBox, add the TableCells With a given Tooltip. Something like this:

Table table = new Table();
table.Columns.Add(new TableColumn());
table.RowGroups.Add(new TableRowGroup());
TableRow r = new TableRow();
table.RowGroups[0].Rows.Add(r);
var ci = new TableCell(new Paragraph(new Run("Text here")));
ci.ToolTip = "tooltip to be displayed";
r.Cells.Add(ci);


or this:

<RichTextBox IsReadOnly="True">
<FlowDocument >
<Table>
<TableRowGroup>
<TableRow>
<TableCell ToolTip="This is a tooltip">
<Paragraph>
<Run>......somthing......</Run>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
</RichTextBox>


But this is not working. I checked and the PreviewMouseMove event gets fired for the TableCells.

Any help is appreciated.

Answer Source

You need to allow tooltip showing on Disabled controls:

<RichTextBox  IsReadOnly="True">
    <FlowDocument >
        <Table>
            <TableRowGroup>
                <TableRow>
                    <TableCell BorderThickness="2" BorderBrush="Black" ToolTip="This is a tooltip" ToolTipService.ShowOnDisabled="True">
                        <Paragraph>
                            <Run>......something......</Run>
                        </Paragraph>
                    </TableCell>
                </TableRow>
            </TableRowGroup>
        </Table>
    </FlowDocument>
</RichTextBox>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download