How to limit cursor movement in WPF based app?
问题 I'm working with a WPF app, more specifically a Canvas with draggable elements. Once an item is being dragged, I'd like to limit the scope of cursor movement to inside the canvas where the items are being dragged about. The event which can start a drag is shown below private void WidgetCanvas_PreviewHeaderLeftMouseDown(object sender, MouseButtonEventArgs e) { e.Handled = true; ... logic to figure out if this is a valid drag, blah blah blah ... this.IsDragging = true; // TODO: clip the