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.
Hello,
Thank you for reply. However solution with scroll bar isnt completly valid. After you scroll to the top, NeValue and VerticalViewOffset are set to 0. If you keep scrolling up the value cannot change because its still 0 and event doesnt fire. When I set ScrollBar.Value = 400 with first time Value_changed fired it move scroll to desired position but every next
scroll up give me:
e.NewValue = 0
e.OldValue = 400
and it doesnt change. It should be:
e.NewValue = 380
e.OldValue = 400.
However when we scroll down we get:
e.NewValue = 20
It also doesnt count Value I set.
When I try set VerticalViewOffset Property to any value
(e.g paragraphs.ElementAt(30).GetDocumentSpan().Offset )
it always keep value = 0, regardles my changes;
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.
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?
Any help?