示例#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();
        }
示例#2
0
        /// <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();
        }
示例#3
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
            {
            }
        }
示例#4
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);
            }
        }
示例#5
0
        /// <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();
        }