Jobi Joy
Jobi Joy

Reputation: 50048

'Quick Text' editing like in MS word - WPF

I want a special TextBox (May be RichTextBox) in to which I need to type lot of text and predefined fields. When I enter a special char '[' I need to get a VS like intellisense popup and mark the inserted text in a special manner like below alt text http://img213.imageshack.us/img213/8324/exce.png

So please suggest me a way to make the inserted field selectable as in word. so the double click on the field can bring the popup again and delete on selection should delete the entire field.

The intellisense part is working for me by adding a PopUp control below the TextBox.

Upvotes: 0

Views: 427

Answers (1)

Jack Ukleja
Jack Ukleja

Reputation: 13521

You can add any controls you like into the middle of a FlowDocument using the BlockUIContainer or InlineUIContainer ?

After you press your special character you could insert a control into the document...

        <RichTextBox>
            <FlowDocument>
            <Paragraph>
                Some text here followed directly by a button...
                <InlineUIContainer>
                    <Button Width="20" Height="20"/>
                </InlineUIContainer>
                            </Paragraph>
            </FlowDocument>
        </RichTextBox>

If you replace Button with your custom control for doing your special field input (including handling double click event for editing), then the highlight/delete is handled by the RichTextBox...

Upvotes: 2

Related Questions