///
        internal override void SetValueCore(double val)
        {
            double       horizontalPercent = -1;
            double       verticalPercent   = -1;
            ScrollBar    sb = Owner as ScrollBar;
            ScrollViewer sv = sb.TemplatedParent as ScrollViewer;

            if (sv == null)
            {
                base.SetValueCore(val);
            }
            else
            {
                if (sb.Orientation == Orientation.Horizontal)
                {
                    horizontalPercent = (val / (sv.ExtentWidth - sv.ViewportWidth)) * 100;
                }
                else
                {
                    verticalPercent = (val / (sv.ExtentHeight - sv.ViewportHeight)) * 100;
                }

                ScrollViewerAutomationPeer svAP           = UIElementAutomationPeer.FromElement(sv) as ScrollViewerAutomationPeer;
                IScrollProvider            scrollProvider = svAP as IScrollProvider;
                scrollProvider.SetScrollPercent(horizontalPercent, verticalPercent);
            }
        }
Example #2
0
        // Token: 0x060027D3 RID: 10195 RVA: 0x000BAACC File Offset: 0x000B8CCC
        internal override void SetValueCore(double val)
        {
            double       horizontalPercent = -1.0;
            double       verticalPercent   = -1.0;
            ScrollBar    scrollBar         = base.Owner as ScrollBar;
            ScrollViewer scrollViewer      = scrollBar.TemplatedParent as ScrollViewer;

            if (scrollViewer == null)
            {
                base.SetValueCore(val);
                return;
            }
            if (scrollBar.Orientation == Orientation.Horizontal)
            {
                horizontalPercent = val / (scrollViewer.ExtentWidth - scrollViewer.ViewportWidth) * 100.0;
            }
            else
            {
                verticalPercent = val / (scrollViewer.ExtentHeight - scrollViewer.ViewportHeight) * 100.0;
            }
            ScrollViewerAutomationPeer scrollViewerAutomationPeer = UIElementAutomationPeer.FromElement(scrollViewer) as ScrollViewerAutomationPeer;
            IScrollProvider            scrollProvider             = scrollViewerAutomationPeer;

            scrollProvider.SetScrollPercent(horizontalPercent, verticalPercent);
        }
Example #3
0
        private void BtnSetScrollPercent_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            EnsureAutomationPeer();

            if (scrollPresenterAutomationPeer != null)
            {
                scrollPresenterAutomationPeer.SetScrollPercent(
                    Math.Min(100.0, scrollPresenterAutomationPeer.HorizontalScrollPercent + 10.0),
                    Math.Min(100.0, scrollPresenterAutomationPeer.VerticalScrollPercent + 15.0));
            }
        }
        /// <summary>
        /// Scrolls a DataGridRow into view.
        /// </summary>
        /// <param name="itemsControl">The DataGrid containing the row.</param>
        /// <param name="itemContainer">The DataGridRow object.</param>
        protected override void ScrollIntoView(DataGrid itemsControl, DataGridRow itemContainer)
        {
            IScrollProvider scrollInfo = (IScrollProvider)DataGridAutomationPeer.CreatePeerForElement(itemsControl);

            double horizontalScrollPercentBeforeScroll = scrollInfo.HorizontalScrollPercent;
            double verticalScrollPercentBeforeScroll   = scrollInfo.VerticalScrollPercent;

            itemsControl.ScrollIntoView(itemContainer.DataContext, null);

            double horizontalScrollPercentAfterScroll = scrollInfo.HorizontalScrollPercent;
            double verticalScrollPercentAfterScroll   = scrollInfo.VerticalScrollPercent;

            double horizontalDiff = horizontalScrollPercentAfterScroll - horizontalScrollPercentBeforeScroll;
            double verticalDiff   = verticalScrollPercentAfterScroll - verticalScrollPercentBeforeScroll;

            scrollInfo.SetScrollPercent(scrollInfo.HorizontalScrollPercent + (horizontalDiff / 2.0), scrollInfo.VerticalScrollPercent + (verticalDiff / 2.0));
        }
Example #5
0
 public void SetScrollPercent(double horizontalPercent, double verticalPercent)
 {
     _scroller?.SetScrollPercent(horizontalPercent, verticalPercent);
 }
Example #6
0
        public bool SetCurrentValue(GLib.Value value)
        {
            double v = (double)value.Val;

            if (rangeValueProvider != null)
            {
                if (v > rangeValueProvider.Maximum)
                {
                    return(false);
                }
                if (v < rangeValueProvider.Minimum)
                {
                    v = rangeValueProvider.Minimum;
                }

                try {
                    rangeValueProvider.SetValue(v);
                } catch (ArgumentOutOfRangeException e) {
                    Log.Debug(e);
                    return(false);
                } catch (ElementNotEnabledException e) {
                    Log.Debug(e);
                    return(false);
                }

                return(true);
            }

            if (parentScrollProvider == null)
            {
                GetScrollProviderFromParent();
            }

            //TODO: This double validation will be removed in future versions because
            //if your SWF.ScrollBar.Parent doesn't support IScrollProvider then your
            //ScrollBar is not ScrollBar is Pane!!
            if (parentScrollProvider == null)
            {
                return(false);
            }

            if (orientation == OrientationType.Vertical)
            {
                try {
                    parentScrollProvider.SetScrollPercent(parentScrollProvider.HorizontalScrollPercent, v);
                } catch (ArgumentOutOfRangeException e) {
                    Log.Debug(e);
                    return(false);
                }
            }
            else
            {
                try {
                    parentScrollProvider.SetScrollPercent(v, parentScrollProvider.VerticalScrollPercent);
                } catch (ArgumentOutOfRangeException e) {
                    Log.Debug(e);
                    return(false);
                }
            }
            return(true);
        }
Example #7
0
 public void SetScrollPercent(double horizontalPercent, double verticalPercent)
 {
     provider.SetScrollPercent(horizontalPercent, verticalPercent);
 }