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


C# ScrollViewer.ScrollToTop方法代碼示例

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


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

示例1: Load

        public void Load(IPdfSource source, string password = null)
        {
            virtualPanel = VisualTreeHelperEx.FindChild<CustomVirtualizingPanel>(this);
            scrollViewer = VisualTreeHelperEx.FindChild<ScrollViewer>(this);
            virtualPanel.PageRowBounds = parent.PageRowBounds.Select(f => f.SizeIncludingOffset).ToArray();
            imageProvider = new PdfImageProvider(source, parent.TotalPages,
                new PageDisplaySettings(parent.GetPagesPerRow(), parent.ViewType, parent.HorizontalMargin,
                    parent.Rotation),
                password: password);

            if (parent.ZoomType == ZoomType.Fixed)
                CreateNewItemsSource();
            else if (parent.ZoomType == ZoomType.FitToHeight)
                ZoomToHeight();
            else if (parent.ZoomType == ZoomType.FitToWidth)
                ZoomToWidth();

            if (scrollViewer != null)
            {
                scrollViewer.Visibility = Visibility.Visible;
                scrollViewer.ScrollToTop();
            }
        }
開發者ID:nathanashton,項目名稱:Bookie,代碼行數:23,代碼來源:ContinuousMoonPdfPanel.xaml.cs

示例2: AdjustScrollPosition

 /// <summary>
 /// This is the command scroll adjustment code which synchronizes two ScrollViewer instances.
 /// </summary>
 /// <param name="sv">ScrollViewer to adjust</param>
 /// <param name="e">Change in the source</param>
 /// <param name="hadjust">Horizontal adjustment</param>
 /// <param name="vadjust">Vertical adjustment</param>
 private static void AdjustScrollPosition(ScrollViewer sv, ScrollChangedEventArgs e, double hadjust, double vadjust)
 {
     if (e.HorizontalChange != 0 || e.ExtentWidthChange != 0)
     {
         if (e.HorizontalOffset == 0)
             sv.ScrollToLeftEnd();
         else if (e.HorizontalOffset >= e.ExtentWidth-5)
             sv.ScrollToRightEnd();
         else if (e.ExtentWidth + hadjust == sv.ExtentWidth)
             sv.ScrollToHorizontalOffset(e.HorizontalOffset + hadjust);
         else
             sv.ScrollToHorizontalOffset((sv.ExtentWidth * (e.HorizontalOffset / e.ExtentWidth)) + hadjust);
     }
     if (e.VerticalChange != 0 || e.ExtentHeightChange != 0)
     {
         if (e.VerticalOffset == 0)
             sv.ScrollToTop();
         else if (e.VerticalOffset >= e.ExtentHeight-5)
             sv.ScrollToBottom();
         else if (e.ExtentHeight + vadjust == sv.ExtentHeight)
             sv.ScrollToVerticalOffset(e.VerticalOffset + vadjust);
         else
             sv.ScrollToVerticalOffset((sv.ExtentHeight * (e.VerticalOffset / e.ExtentHeight)) + vadjust);
     }
 }
開發者ID:ssickles,項目名稱:archive,代碼行數:32,代碼來源:SynchronizeScrollingBehavior.cs

示例3: ResetScrollPositions

    internal static void ResetScrollPositions( ScrollViewer scrollViewer )
    {
      if( scrollViewer == null )
      {
        throw new ArgumentNullException( "scrollViewer" );
      }

      DataGridScrollViewer dataGridScrollViewer = scrollViewer as DataGridScrollViewer;
      if( dataGridScrollViewer != null )
      {
        foreach( SynchronizedScrollViewer ssv in dataGridScrollViewer.SynchronizedScrollViewers )
        {
          ssv.ScrollToTop();
          ssv.ScrollToLeftEnd();
        }
      }

      scrollViewer.ScrollToTop();
      scrollViewer.ScrollToLeftEnd();

    }
開發者ID:wangws556,項目名稱:duoduo-chat,代碼行數:21,代碼來源:ScrollViewerHelper.cs


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