Пример #1
0
        private static void OnAutoShiftChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }

            if (e.NewValue == e.OldValue)
            {
                return;
            }

            EasyCarousel instance = d as EasyCarousel;

            if (instance == null)
            {
                return;
            }

            if ((bool)e.NewValue)
            {
                instance._timer.Interval = instance.Interval;
                instance._timer.Start();
            }
            else
            {
                instance._timer.Stop();
            }
        }
Пример #2
0
        private static void OnSelectedIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }

            if (e.NewValue == e.OldValue)
            {
                return;
            }

            EasyCarousel instance = d as EasyCarousel;

            if (instance == null)
            {
                return;
            }

            if (DesignMode.DesignModeEnabled)
            {
                return;
            }

            instance.ShiftElementsAnimatedly((int)e.NewValue);

            instance.SelectedItem = (instance.Children[(int)e.NewValue] as FrameworkElement)?.DataContext;
        }
Пример #3
0
        private static void OnIntervalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }

            if (e.NewValue == e.OldValue)
            {
                return;
            }

            EasyCarousel instance = d as EasyCarousel;

            if (instance == null)
            {
                return;
            }

            instance._timer.Interval = (TimeSpan)e.NewValue;
        }
Пример #4
0
        private static void OnItemSpacingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }

            if (e.NewValue == e.OldValue)
            {
                return;
            }

            EasyCarousel instance = d as EasyCarousel;

            if (instance == null)
            {
                return;
            }

            instance.InvalidateArrange();
        }
Пример #5
0
        private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }

            if (e.NewValue == e.OldValue)
            {
                return;
            }

            EasyCarousel instance = d as EasyCarousel;

            if (instance == null)
            {
                return;
            }

            instance.BindItems();

            instance.SelectedItem = (instance.Children[instance.SelectedIndex] as FrameworkElement)?.DataContext;
        }