private static void ComputeIsAlternate(FlipControl flp) { if (flp == null) { return; } flp.AnimationCompleted = false; var root = flp.GetTemplateChild("root") as FrameworkElement; if (root == null) { return; } string storyboardName = (flp.IsAlternate ? "goToAlternate" : "goToMain") + flp.Orientation; var sb = root.Resources[storyboardName] as Storyboard; if (sb == null) { return; } EventHandler <object> h = null; h = (s, e) => { sb.Completed -= h; flp.AnimationCompleted = true; }; sb.Completed += h; sb.Begin(); }
/// <summary> /// Handles changes to the IsAutoFlipping property. /// </summary> private static void OnIsAutoFlippingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FlipControl target = (FlipControl)d; bool oldIsAutoFlipping = (bool)e.OldValue; bool newIsAutoFlipping = target.IsAutoFlipping; target.OnIsAutoFlippingChanged(oldIsAutoFlipping, newIsAutoFlipping); }