I am trying to change the position of the horizontal scrollBar of an ultraTree. I tried "TopNode" and "ActiveNode" properties. But these properties just change the position of vertical scroll bar. I am using Infragistics v 15.1. Is there a way to change the position of the horizontal scroll bar?
What, exactly, are you trying to do? If you want to scroll a particular node into view, there's a BringIntoView method on the control you could use. That should scroll both vertically and horizontally if I am not mistaken.
Why would you want to set the scroll position to a specific number of pixels? I'm not sure if there is any way to do that. But if there is, you would probably have to somehow get the ScrollbarInfo from the scrollbar UIElements. It would be very tricky.
Is it also possible to do this for VScrollPosion ? I tried following code
PropertyInfo scrollbarControlInfo = ultraTree1.GetType().GetProperty("ScrollbarControl", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty);
var scrollControl = scrollbarControlInfo.GetValue(this.ultraTree1, null); MethodInfo SetVScrollPositionMethod = scrollControl.GetType().GetMethod("SetVScrollPosition", BindingFlags.NonPublic | BindingFlags.Instance);
SetVScrollPositionMethod.Invoke(scrollControl, new object[] { 20 });
But SetVScrollPositionMethod is coming null , any idea ? or there exist no SetVScrollPositionMethod ?
Hello Amal,
Thank you for your feedback.
Scrolling of UltraTree is controlled by internal class named ScrollbarControl. So in order to set the scrollbar position you need to get a reference to this control. You can achieve this via reflection. Please check the attached sample solution where I have implement setting of the horizontal scrollbar position.
Please let me know if you need any additional information.
Thank you for using Infragistics Controls.
Thank you for the reply,
Not exactly !
Actually, I am implementing search for an ultraTree. When we run search , the first search result is highlighted in orange and the other search results are highlighted in yellow. When we click on the "Next" button, the next search result is highlighted in orange. Sometimes, the search result is at the end of the text node. We move the horizontal scroll bar manually to view it. Our idea is to move the horizontal scroll bar depending on the search result position.
Do you have any idea how to do it?
Thank you for posting in our forum.
UltraTree does not expose public method or property to set the horizontal scroll position. However you can use the next method to scroll the tree:
BringLabelIntoView – brings the corresponding label (header) into view. More about this method you may find by following the next link http://help.infragistics.com/Help/Doc/WinForms/2015.2/CLR4.0/html/Infragistics4.Win.UltraWinTree.v15.2~Infragistics.Win.UltraWinTree.UltraTreeNode~BringLabelIntoView.html.
BringCellIntoView – brings the corresponding to the specified column cell into view. More about this you may find by following the next link http://help.infragistics.com/Help/Doc/WinForms/2015.2/CLR4.0/html/Infragistics4.Win.UltraWinTree.v15.2~Infragistics.Win.UltraWinTree.UltraTreeNode~BringCellIntoView.html.
You can also use BringIntoView method – it will scroll vertically and horizontally in order to bring the specified tree into viewable area of the control. More about this method you may find by following the next link http://help.infragistics.com/Help/Doc/WinForms/2015.2/CLR4.0/html/Infragistics4.Win.UltraWinTree.v15.2~Infragistics.Win.UltraWinTree.UltraTreeNode~BringIntoView.html.
Please let me know if this is what you are looking for or if I am missing something.