Exemplo n.º 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();
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 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();
        }
Exemplo n.º 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;
        }