Question

I'm creating a RichTextBox which contains various different InlineUIContainers, but can't seem to get button click events within those containers to work. If I set IsDocumentEnabled = true for the RichTextBox, then BlockUIContainer click events will work; however, InlineUIContainer click events still do not work.

Does anybody know if such functionality is possible?

EDIT: Adding a code example.

This works:

<RichTextBox IsDocumentEnabled="True">
    <FlowDocument>
        <BlockUIContainer>
            <Button Click="SomeEvent">
        </BlockUIContainer>
        <Paragraph>
            ... Some Content ...
        </Paragraph>
    </FlowDocument>
</RichTextBox>

But this doesn't:

<RichTextBox IsDocumentEnabled="True">
    <FlowDocument>
        <Paragraph>
            <InlineUIContainer>
                <Button Click="SomeEvent" />
            </InlineUIContainer>
         </Paragraph>
    </FlowDocument>
</RichTextBox>
Was it helpful?

Solution

It turns out I was wrapping them in a tag that had IsHitTestVisible=true set, but it wasn't terribly obvious. Works great now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top