Hello,
I'm trying to synchronize two UltraFormattedTextEditor controls and for that purpose I'd need OnScroll event. Please help.
Regards,
Slava.
Hi Slava,
Currently, there is no event for scrolling. You should Submit a feature request to Infragistics
Hello Slava,
Mike is right that we have not such kind of event, but maybe one very custom approach to add Scroll events is to inherit our UltraFormattedTextEditor controls and create your own events. Please look at the code below. I made one small sample which represent such kind of approach. In the sample I add two events (VScroll – for vertical scrolling and HScroll – for horizontal scrolling). Please take a look at the attached sample for more details.
Please let me know if you have any questions.
Regards
public class MyultraFormattedTextEditor : UltraFormattedTextEditor
{
private ScrollBarUIElement vScrollBar;
private ScrollBarUIElement hScrollBar;
private ScrollEventArgs scaVert;
private ScrollEventArgs scaHoriz;
private int VOldValue;
private int VNewValue;
private int HOldValue;
private int HNewValue;
public MyultraFormattedTextEditor()
this.PreviewKeyDown+=new PreviewKeyDownEventHandler(MyultraFormattedTextEditor_PreviewKeyDown);
}
void MyultraFormattedTextEditor_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
this.vScrollBar = this.UIElement.ChildElements[0].ChildElements[0].ChildElements[1] as ScrollBarUIElement;
this.hScrollBar = this.UIElement.ChildElements[0].ChildElements[0].ChildElements[2] as ScrollBarUIElement;
VNewValue = Convert.ToInt32((vScrollBar.AccessibilityInstance).Value);
HNewValue = Convert.ToInt32((hScrollBar.AccessibilityInstance).Value);
if (vScrollBar.Enabled && VOldValue != VNewValue)
scaVert = new ScrollEventArgs(ScrollEventType.ThumbPosition, VOldValue, VNewValue, ScrollOrientation.VerticalScroll);
VScroll(this, scaVert);
VOldValue = VNewValue;
if (hScrollBar.Enabled && HOldValue != HNewValue)
scaHoriz = new ScrollEventArgs(ScrollEventType.ThumbPosition, HOldValue, HNewValue, ScrollOrientation.HorizontalScroll);
HScroll(this, scaHoriz);
public delegate void ChangingHandler(object sender, ScrollEventArgs MyEventArg);
public event ChangingHandler VScroll;
public event ChangingHandler HScroll;
Hi Mark.
Thanks a lot for a fast answer. I've filled the request.
Hello Georgi,
Thank you very much for your help. I'll definitely try the proposed solution.
I've implemented the proposed solution, but I see that MyultraFormattedTextEditor_PreviewKeyDown() function is not called. Did I miss something?