当前位置: 首页>>代码示例>>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;未经允许,请勿转载。