【发布时间】:2009-03-19 01:11:46
【问题描述】:
我正在使用 WPF,并且在 RichTextBox 控件中有一个表格。我需要获取表格单元格的背景颜色以更改它获得焦点。我的问题是我无法为 TableCell 触发 GotFocus 或任何其他事件。
<RichTextBox>
<FlowDocument>
<Table>
<Table.Columns>
<TableColumn />
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell GotFocus="SelectionCell_GotFocus">
<Paragraph>1</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
</RichTextBox>
下图显示了 RichTextBox 控件中的表格。我希望能够在用户在表格单元格之间移动时更改背景。
alt text http://img16.imageshack.us/img16/8151/wpftable.png
编辑:经过更多调查,问题不仅限于 RichTextBox 中的表格,RichTextBox 中的任何控件似乎都无法生成事件。我在其中放置了一个按钮,但无法让它触发其 Click 事件。看起来 RichTextBox 屏蔽了所有事件,希望有办法取消屏蔽它们。
【问题讨论】:
标签: wpf focus richtextbox