I have a RichTextbox that I would like to add button control and make it enabled for clicks.
Unfurtunatlly when you add it, it gets automatically disabled
it seems to be a FlowDocument limitation, but since this is a very simple requirement. I found hard to believe there is no clean way to enable it.
This is a solution by creating a new control extending FlowDocument but I would like to avoid it.
Description of the workaround Is there a clean way of accomplishing this?
<RichTextBox x:Name="txt1" HorizontalAlignment="Left" Height="183" Margin="36,10,0,0" VerticalAlignment="Top" Width="508">
<FlowDocument IsEnabled="True">
<Paragraph LineHeight="1">
<Button Content="Button" Height="25" Width="93" Click="Button_Click_1"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
Just set IsDocumentEnabled
property of RichTextBox
to true:
<RichTextBox x:Name="txt1" IsDocumentEnabled="True" HorizontalAlignment="Left" Height="183" Margin="36,10,0,0" VerticalAlignment="Top" Width="508">
<FlowDocument IsEnabled="True">
<Paragraph LineHeight="1">
<Button Content="Button" Height="25" Width="93" Click="Button_Click_1"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With