/// <summary> /// The on items source changed. /// </summary> /// <param name="dependencyObject"> The dependency object. </param> /// <param name="e"> The e. </param> private static void OnItemsSourceChanged( DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { FlipControl flipControl = (FlipControl)dependencyObject; if (flipControl.eventHandler == null) { flipControl.eventHandler = (sender, e2) => { flipControl.Animate(); }; } INotifyCollectionChanged oldCollection = e.OldValue as INotifyCollectionChanged; if (oldCollection != null) { oldCollection.CollectionChanged -= flipControl.eventHandler; } INotifyCollectionChanged newCollection = e.NewValue as INotifyCollectionChanged; if (newCollection != null) { newCollection.CollectionChanged += flipControl.eventHandler; } flipControl.Animate(); }
/// <summary> /// The on apply template. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); this.flipControl = (FlipControl)this.GetTemplateChild("PART_FlipControl"); this.flipControl.ItemsSource = new List <int>() { 0 }; this.Update(); }
/// <summary> /// The on selected index proxy changed. /// </summary> /// <param name="dependencyObject"> The dependency object. </param> /// <param name="e"> The Event Arguments. </param> private static void OnSelectedIndexProxyChanged( DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { FlipControl flipControl = (FlipControl)dependencyObject; try { flipControl.SelectedIndex = flipControl.SelectedIndexProxy; } catch { } }
/// <summary> /// The on integer changed. /// </summary> /// <param name="dependencyObject"> The dependency object. </param> /// <param name="e"> The e. </param> private static void OnIntegerChanged( DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { FlipControl flipControl = (FlipControl)dependencyObject; if (flipControl.Integer.HasValue) { int?oldInteger = (int?)e.OldValue; int newInteger = flipControl.Integer.Value; flipControl.AnimateInteger(oldInteger.HasValue ? oldInteger.Value : 0, newInteger); } }
/// <summary> /// The on apply template. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); this.flipControl = (FlipControl)this.GetTemplateChild("PART_FlipControl"); this.flipControl.ItemsSource = new List<int>() { 0 }; this.Update(); }