In the recent project, I want to control the scrollViewer on the diagram and set the offset of the scrollViewer. I looked at the API and found that the offset property is not public. What should I do?
Any help would be appreciated.
3 Answers, 1 is accepted
0
Dinko | Tech Support Engineer
Telerik team
answered on 18 Jan 2019, 12:09 PM
Hello Yuanhong,
I am not sure how you have added the ScrollViewer to the RadDiagram control but the ScrollViewer itself has a ScrollToHorizontalOffset() and ScrollToVerticalOffset() methods which you can use to change the offset. May I ask you to elaborate more on your application set up so I could better understand your scenario.
Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.
but,RadDiagram can't find Scrollviewer by this way.
0
Dinko | Tech Support Engineer
Telerik team
answered on 23 Jan 2019, 02:21 PM
Hi Yuanhong,
Thank you for elaborating your approach.
When the ScrollViewer.HorizontalScrollBarVisibility and ScrollViewer.VerticalScrollBarVisibility are set to Visible ScrollBar will be added to the RadDiagram, not ScrollViewer. That is why the ChildrenOfType<T>() will return null. The ScrollBar provide Value property which can be set to change the position of the thumb. For example, you can subscribe to the loaded event of the RadDiagram and using the mentioned extension method you can get the horizontal and vertical scrollbars. The following code snippet gets the vertical scrollbar and set the value of 50 where the Maximum property is 100 on my side.
var verticalOrientation = diagram.ChildrenOfType<ScrollBar>().FirstOrDefault(x=>x.Orientation== Orientation.Vertical);
verticalOrientation.Value = 50;
}
Regards,
Dinko
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.