private void BeginTilting(FrameworkElement element, PointerRoutedEventArgs args) { FrameworkElement elementToTilt = GetElementToTilt(element); if (this.currentTiltContext != null) { this.EndTilting(false); } Point origin = args.GetCurrentPoint(elementToTilt).Position; this.currentTiltContext = new TiltInteractionInfo(elementToTilt, this.CreateResetAnimation(elementToTilt, elementToTilt)); elementToTilt.Unloaded += this.OnElementToTilt_Unloaded; elementToTilt.PointerCaptureLost += this.OnElementToTilt_PointerCaptureLost; this.AttachRootVisualEvents(); this.ApplyTilt(this.currentTiltContext.TargetElement, origin); }
private void EndTilting(bool animate) { // no currently tilted element if (this.currentTiltContext == null) { return; } this.currentTiltContext.TargetElement.Unloaded -= this.OnElementToTilt_Unloaded; this.currentTiltContext.TargetElement.PointerCaptureLost -= this.OnElementToTilt_PointerCaptureLost; this.DetachRootVisualEvents(); this.currentTiltContext.State = TiltInteractionState.EndingTilting; this.currentTiltContext.Clear(animate); if (!animate) { this.currentTiltContext = null; } }