1

I have code like this

<RichTextBox IsDocumentEnabled="True" Name="doc">
<FlowDocument>
    <Section>
        <BlockUIContainer>
            <StackPanel>
                <Image Height="30" Width="30" HorizontalAlignment="Left" Source="Notify.png">
                </Image>
                <TextBlock Text="message body">
                </TextBlock>
            </StackPanel>
        </BlockUIContainer>
    </Section>
    <Section>
        <Paragraph Margin="0,0,500,0" LineHeight="50">
            <Paragraph.Background>
                <ImageBrush ImageSource="bg1.png" Stretch="UniformToFill"/>
            </Paragraph.Background>
            test pure document text 
        </Paragraph>
        <Paragraph>
            <Run>
                <Run.Background>
                    <ImageBrush ImageSource="bg1.png"/>
                </Run.Background>
                run back groud,run back groud,run back groudrun back groudrun back groudrun back groudrun back groudrun back groudrun back groudrun back groudrun back groud
            </Run>
        </Paragraph>
    </Section>
<FlowDocument>

in this RichTextBox control , I add a control element and a document element. I could freely select text from the document element, while could not do it for UI control element.

enter image description here

Second part. I wana set a Run element background like a control or container do. in above picture , the text block " run back groud,..." background is a little strange. what effect I need is below. enter image description here

Any Idea? thanks

songtzu
  • 90
  • 2
  • 12
  • http://stackoverflow.com/questions/136435/any-way-to-make-a-wpf-textblock-selectable – Lucian Nov 11 '15 at 10:17
  • @Lucian I tried this before. selectable textblock does not work in richtextbox. mousedown event did't fire in selectable textblock. besides , multi block (UI control like selectable textblocks) could not freely select acrossing multi control, It just could select in one control. – songtzu Nov 11 '15 at 10:34

0 Answers0