Esempio n. 1
0
        public void ScrollLast()
        {
            VirtualStackPanel vsp = getPanel();

            if (vsp != null)
            {
                updateHorizOffset(vsp.ExtentWidth);
            }
        }
Esempio n. 2
0
        public void ScrollFirst()
        {
            VirtualStackPanel vsp = getPanel();

            if (vsp != null)
            {
                updateHorizOffset(0);
            }
        }
Esempio n. 3
0
        public void ScrollRight()
        {
            VirtualStackPanel vsp = getPanel();

            if (vsp != null)
            {
                updateHorizOffset(ScrollOffset + vsp.ViewportWidth);
            }
        }
Esempio n. 4
0
 private VirtualStackPanel getPanel()
 {
     if (_scroll != null)
     {
         ItemsPresenter    ip  = UITools.FindVisualChild <ItemsPresenter>(this);
         VirtualStackPanel vsp = UITools.FindVisualChild <VirtualStackPanel>(ip);
         return(vsp);
     }
     return(null);
 }
Esempio n. 5
0
        public bool CanScrollLeft()
        {
            VirtualStackPanel vsp = getPanel();

            if (vsp != null)
            {
                if (vsp.ExtentWidth < vsp.ViewportWidth)
                {
                    return(false);
                }
            }
            return(finalOFfset > 0);
        }
Esempio n. 6
0
 private void updateScrollViewer()
 {
     if (_scroll != null)
     {
         ItemsPresenter    ip  = UITools.FindVisualChild <ItemsPresenter>(this);
         VirtualStackPanel vsp = UITools.FindVisualChild <VirtualStackPanel>(ip);
         if (vsp != null)
         {
             double itemFitInViewPort = vsp.ViewportWidth / ActualHeight;
             double offsetMiddle      = ((vsp.ViewportWidth + ActualHeight) / 2);
             //double newOffset = (ChildWidth * (SelectedIndex - (itemFitInViewPort / 2)));
             double newOffset = (ActualHeight * (SelectedIndex + 1)) - offsetMiddle;
             updateHorizOffset(newOffset);
         }
     }
 }
Esempio n. 7
0
        private void updateHorizOffset(double offset)
        {
            VirtualStackPanel vsp = UITools.FindVisualChild <VirtualStackPanel>(this);

            //ppanel.Dispatcher.BeginInvoke(DispatcherPriority.Background, new ThreadStart(() =>
            CommandManager.InvalidateRequerySuggested();    //));

            finalOFfset = offset;
            DoubleAnimation moveAnimation = new DoubleAnimation();

            moveAnimation.To = offset;
            bool largeChange = Math.Abs(ScrollOffset - offset) > ActualHeight;

            moveAnimation.Duration = new Duration(TimeSpan.FromSeconds(AutoPlay ? 0 : largeChange ? 1 : 0.5));
            this.BeginAnimation(PreviewPanelBase.ScrollOffsetProperty, moveAnimation);
        }