For example if i have code like the following both Buttons are disabled:
<RichTextBox>
<FlowDocument>
<BlockUIContainer>
<Button Content="!"/>
</BlockUIContainer>
<Paragraph>
<InlineUIContainer>
<Button Content="!"/>
</InlineUIContainer>
</Paragraph>
</FlowDocument>
</RichTextBox>
I have no idea why this is the case or what i can do to prevent this, obviously disabled buttons are not very useful so any help to resolve this would be appreciated.
Edit: It turns out that the FlowDocument gets disabled for some reason, however i have not found a way to reenable it yet, since it changes back to IsEnabled="False"
immediately...
There actually is a property called
IsDocumentEnabled
(.NET 3.5 onwards) on theRichTextBox
itself that can be set to true to enable the document.You might need to make your custom flowdocument and override its IsEnabledCore property. Check this link out - http://learnwpf.com/post/2007/01/18/When-I-add-Controls-to-a-WPF-RichTextBox-They-Are-Always-Disabled-How-can-I-change-that.aspx