private void OnInputMove(InputEventArgs e) { InputDevice inputDevice = e.Device; DependencyObject captured = inputDevice.GetCaptured() as DependencyObject; NThiefData userData = inputDevice.GetUserData(s_strThiefDataKey) as NThiefData; if (((userData != null) && ((captured == null) || (userData.ThiefID == this.m_refThiefID))) && (userData.MustBeStealed && (inputDevice.GetCaptured() != this.Owner))) { inputDevice.Capture(this.Owner); } else if (((captured != null) && (userData != null)) && (userData.ThiefID == this.m_refThiefID)) { int maxInputToSteal = GetMaxInputToSteal(captured); if (captured is FrameworkElement) { FrameworkElement element = captured as FrameworkElement; if (element.TouchesCaptured.Count <TouchDevice>() > maxInputToSteal) { return; } } bool?nullable = GetParentStealCaptureOrientation(captured).CheckValidMovementForOrientation(userData.OriginPosition, inputDevice.GetPosition(this.Owner), GetParentStealCaptureRadiusThreshold(captured), GetParentStealCaptureWrongDirectionThreshold(captured)); if (nullable.HasValue && nullable.Value) { inputDevice.SetUserData(s_strThiefDataKey, null); inputDevice.Capture(this.Owner); } else if (!nullable.HasValue) { inputDevice.SetUserData(s_strThiefDataKey, null); } } }