You're on the right path with using PreviewPan
, you can cancel a Pan operation by setting the Handled
property of the PositionChangedRoutedEventArgs
Here's a simple example:
sender, PositionChangedRoutedEventArgs e)
Point myRestrictedPoint =
// If the pan operation is going to go where I don't want it to
(e.NewPosition.X > myRestrictedPoint.X || e.NewPosition.Y > myRestrictedPoint.Y)
// Cancel and 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!
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.