tags:

views:

11

answers:

0

I'm using a RichTextBox in WPF and want to:

  1. Input text
  2. Save text to an object
  3. Save the selection
  4. Clear RTB
  5. Insert the text from the object
  6. Set the previous selection again

1 and 2 is done, easy. I can easily save the selection using the Selection property on the RTB to get the TextSelection object. But after clearing the RTB the, the TextSelection object changes so i cannot use it to restore the selection.

So how can i achive this?