| List<SelectionRangeExt> selectionRanges = new List<SelectionRangeExt>(); /// <summary> /// Saves the selection start and end indexes into collection. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { SelectionRangeExt range = new SelectionRangeExt(); range.Start = richTextBoxAdv.Selection.Start.GetHierarchicalIndex; range.End = richTextBoxAdv.Selection.End.GetHierarchicalIndex; selectionRanges.Add(range); } /// <summary> /// Gets the TextPosition from the given hierarchical index. /// </summary> /// <param name="hierarchicalIndex">The hierarchical index.</param> /// <returns>The <see cref="TextPosition"/> instance.</returns> public TextPosition GetTextPoistion(string hierarchicalIndex) { if (hierarchicalIndex == null) return null; return richTextBoxAdv.Document.GetTextPosition(hierarchicalIndex); } |
Hi Jimmi,
Thank you for your update.
At present, SfRichTextBoxAdv does not support dynamic update of TextPosition instance. We have used TextPosition instance only for holding the static positions of selection start and end.Could you please share your complete requirement (in detail) with SfRichTextBoxAdv? So that, we can analyze in line with your requirement and provide our suggestion for direct solutions using SfRichTextBoxAdv control.
Regards,
Venkatesan M.
| Dear client, The event named <<Event1:name>> will be taken place in <<Event1:location>> in <<Event1:date>>. Event details: <<Event1:details>>. |
Hi Jimmi,
Thank you for your update.
As mentioned earlier, SfRichTextBoxAdv does not support dynamic update of TextPosition instance. The dynamic update of TextPosition instance implementation within SfRichTextBoxAdv control will impact performance based on the live instances of TextPosition class. So, we did not consider implementing the dynamic update of TextPosition instances within SfRichTextBoxAdv control.As a workaround, you can achieve your requirement reliably using find and replace functionality of SfRichTextBoxAdv control with slight modification in your template content.
Please find the steps to achieve your requirement:1. Redefine your template content with unique placeholders (Set some protocols), which will be replaced with event data.For example:
Dear client,The event named <<Event1:name>> will be taken place in <<Event1:location>> in <<Event1:date>>.Event details: <<Event1:details>>.2. Use the find and replace functionality of SfRichTextBoxAdv control, to replace with respective event data.
We have prepared a sample to demonstrate the same. Please find the sample from following link and let us know if this helps you.
Sample link:
Sample.zip.
Please let us know if you have any other questions.
Regards,
Venkatesan M.