This is a migrated thread and some comments may be shown as answers.

Restrict the pan area on diagram

1 Answer 98 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Jenny
Top achievements
Rank 1
Jenny asked on 23 Jan 2017, 08:39 PM

We are using the RadDiagram for Telerik WPF. We have restricted the draggable area using the following link:

http://docs.telerik.com/devtools/wpf/controls/raddiagram/howto/customize-dragging

But we also would like to restrict the area that the user is able to pan the diagram. It would be great if it wasn´t possible to pan away from the restricted draggable area. Is this possible, and if yes, how?

I have tried to use PreviewPan but haven´t figured out if that is the way to go...

1 Answer, 1 is accepted

Sort by
0
Accepted
Lance | Senior Manager Technical Support
Telerik team
answered on 25 Jan 2017, 06:45 PM
Hi Jenny,

You're on the right path with using PreviewPan, you can cancel a Pan operation by setting the Handled property of the PositionChangedRoutedEventArgs to true.

Here's a simple example:

private void Diagram_OnPreviewPan(object sender, PositionChangedRoutedEventArgs e)
{
    Point myRestrictedPoint = new Point(); 
 
    // If the pan operation is going to go where I don't want it to
    if (e.NewPosition.X > myRestrictedPoint.X || e.NewPosition.Y > myRestrictedPoint.Y)
    {
        // Cancel and return
        e.Handled = true;
        return;
    }
}


This should get you what you're looking for. However, if it doesn't please open a Support Ticket here and share the reproducible project code with us so that we can investigate directly. Support Tickets carry a guaranteed response time from the UI for WPF support team (which is within 24 hours for your license).

Thank you for choosing UI for WPF!

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Diagram
Asked by
Jenny
Top achievements
Rank 1
Answers by
Lance | Senior Manager Technical Support
Telerik team
Share this question
or