Ejemplo n.º 1
0
        /// <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();
        }
Ejemplo n.º 2
0
        /// <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
            {
            }
        }
Ejemplo n.º 3
0
        /// <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);
            }
        }