Hello!
I am using xamRichTextEditor for a TextChat with avatars. I cannot figure out how scroll down after TextInput.
Second thing: Is possible to detect if user is scrolling up to first line? (trying implement history load like in Skype, when we scorlling up older and older history is loading)
Please for assistance.
First part I mostly manage with code:
internal void ScrollDown() { const RichTextEditorCommandType type = RichTextEditorCommandType.MoveToEndOfDocument; var cmd = new RichTextEditorCommand(type); cmd.Execute(RichTextBox); }but it's not perfect solution. Text its scrolling only to top of last paragraph
but not at bottom
There left 1 mouse scroll down of space. Any idea how to fix it?
Hello Artur,
I have been looking into your requirements. If I understood correctly your first question you need to submit some content in the XamRichTextEditor via a button or other command and you need to ensure that the last submitted content is visible. What I can suggest in order to achieve this functionality is setting the VerticalViewOffset property of the XamRichTextEditor’s ActiveDocumentView object to the offset of the last paragraph available in the editor. The code will look similar to the following:
var paragraphs = document.GetParagraphs(DocumentSpan.All);
if (paragraphs != null && paragraphs.Count() > 0)
xamRichTextEditor1.ActiveDocumentView.VerticalViewOffset = paragraphs.LastOrDefault().GetDocumentSpan().Offset;
Regarding the second part of your requirements, I believe the best way would be to use our Utilites class’ GetDescendantFromType method in order to get the scrollbar of the XamRichTextEditor. Then you can subscribe to its ValueChanged event and insert the older paragraphs when certain conditions are fulfilled.
Both of the described approaches are implemented in the sample application I am attaching for your reference. If you have any further questions on this matter, please do not hesitate to let us know.
Thank you for using Infragistics Components.