rmojab63
rmojab63

Reputation: 3631

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.

Upvotes: 1

Views: 242

Answers (2)

Vatsan
Vatsan

Reputation: 1173

Set ToolTipServices.ShowOnDisabled="True", like this:

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

Upvotes: 0

Spawn
Spawn

Reputation: 935

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>

Upvotes: 2

Related Questions