當前位置: 首頁>>代碼示例>>C#>>正文


C# ScrollViewer.ChangeView方法代碼示例

本文整理匯總了C#中Windows.UI.Xaml.Controls.ScrollViewer.ChangeView方法的典型用法代碼示例。如果您正苦於以下問題:C# ScrollViewer.ChangeView方法的具體用法?C# ScrollViewer.ChangeView怎麽用?C# ScrollViewer.ChangeView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Windows.UI.Xaml.Controls.ScrollViewer的用法示例。


在下文中一共展示了ScrollViewer.ChangeView方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ScrollByHorizontalOffset

        /// <summary>
        /// Scroll a ScrollViewer horizontally by a given offset.
        /// </summary>
        /// <param name="viewer">The ScrollViewer.</param>
        /// <param name="offset">The horizontal offset to scroll.</param>
        private static void ScrollByHorizontalOffset(ScrollViewer viewer, double offset)
        {
            Debug.Assert(viewer != null, "viewer should not be null!");

            offset += viewer.HorizontalOffset;
            offset = Math.Max(Math.Min(offset, viewer.ExtentWidth), 0);
            viewer.ChangeView(offset, null, null);
        }
開發者ID:siatwangmin,項目名稱:WinRTXamlToolkit,代碼行數:13,代碼來源:ScrollExtensions.cs

示例2: ScrollByVerticalOffset

        /// <summary>
        /// Scroll a ScrollViewer vertically by a given offset.
        /// </summary>
        /// <param name="viewer">The ScrollViewer.</param>
        /// <param name="offset">The vertical offset to scroll.</param>
        private static void ScrollByVerticalOffset(ScrollViewer viewer, double offset)
        {
            Debug.Assert(viewer != null, "viewer should not be null!");

            offset += viewer.VerticalOffset;
            offset = Math.Max(Math.Min(offset, viewer.ExtentHeight), 0);
            viewer.ChangeView(null, offset, null);
        }
開發者ID:siatwangmin,項目名稱:WinRTXamlToolkit,代碼行數:13,代碼來源:ScrollExtensions.cs

示例3: ScrollToProportion

        public static void ScrollToProportion(ScrollViewer scrollViewer, double scrollViewerOffsetProportion)
        {
            // Update the Horizontal and Vertical offset
            if (scrollViewer == null)
            {
                return;
            }

            var scrollViewerHorizontalOffset = scrollViewerOffsetProportion * scrollViewer.ScrollableWidth;
            var scrollViewerVerticalOffset = scrollViewerOffsetProportion * scrollViewer.ScrollableHeight;

            scrollViewer.ChangeView(scrollViewerHorizontalOffset, scrollViewerVerticalOffset, null);
        }
開發者ID:CruzerBoon,項目名稱:Prism-Samples-Windows,代碼行數:13,代碼來源:ScrollViewerUtilities.cs

示例4: ScrollPageHorizontal

        private static void ScrollPageHorizontal(ScrollViewer scrollViewer, ScrollDirection direction)
        {
            if (scrollViewer == null || direction == ScrollDirection.None)
            {
                return;
            }

            double actualWidth = scrollViewer.ActualWidth;
            double currentOffset = scrollViewer.HorizontalOffset;
            double newWidth = 0;

            if (direction == ScrollDirection.Left)
            {
                newWidth = currentOffset - actualWidth;
            }
            else if (direction == ScrollDirection.Right)
            {
                newWidth = currentOffset + actualWidth;
            }

            if (newWidth > scrollViewer.ExtentWidth)
            {
                newWidth = currentOffset;
            }

            if (newWidth < 0)
            {
                newWidth = 0;
            }

            scrollViewer.ChangeView(newWidth, null, null);
        }
開發者ID:ali-hk,項目名稱:Toolkit,代碼行數:32,代碼來源:PagedScrollAction.cs

示例5: ScrollPageVertical

        private static void ScrollPageVertical(ScrollViewer scrollViewer, ScrollDirection direction)
        {
            if (scrollViewer == null || direction == ScrollDirection.None)
            {
                return;
            }

            double actualHeight = scrollViewer.ActualHeight;
            double currentOffset = scrollViewer.VerticalOffset;
            double newHeight = 0;

            if (direction == ScrollDirection.Up)
            {
                newHeight = currentOffset - actualHeight;
            }
            else if (direction == ScrollDirection.Down)
            {
                newHeight = currentOffset + actualHeight;
            }

            if (newHeight > scrollViewer.ExtentHeight)
            {
                newHeight = currentOffset;
            }

            if (newHeight < 0)
            {
                newHeight = 0;
            }

            scrollViewer.ChangeView(null, newHeight, null);
        }
開發者ID:ali-hk,項目名稱:Toolkit,代碼行數:32,代碼來源:PagedScrollAction.cs

示例6: FloatTab_Holding

 private async void FloatTab_Holding(object sender, HoldingRoutedEventArgs e)
 {
     _scrollViewer = listView.GetScrollViewer();
     bool succeed = _scrollViewer.ChangeView(null, 0, null);
     await Task.Yield();
 }
開發者ID:jasonwun,項目名稱:WooBee-Normal,代碼行數:6,代碼來源:TimeLineView.xaml.cs

示例7: listView_Loaded

 private async void listView_Loaded(object sender, RoutedEventArgs e)
 {
     
     _scrollViewer = listView.GetScrollViewer();
     TimeSpan period = TimeSpan.FromMilliseconds(1000);
     Windows.System.Threading.ThreadPoolTimer.CreateTimer(async (source) => {
         await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(() =>
         {
             _scrollViewer.ChangeView(null, App._scrollViewerVerticalOffset, null, true);
         }));
     }, period);
     await TLVm.RefreshNotification();
 }
開發者ID:jasonwun,項目名稱:WooBee-Normal,代碼行數:13,代碼來源:TimeLineView.xaml.cs


注:本文中的Windows.UI.Xaml.Controls.ScrollViewer.ChangeView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。