本文整理汇总了C#中System.Windows.Controls.ScrollViewer.ScrollToLeftEnd方法的典型用法代码示例。如果您正苦于以下问题:C# ScrollViewer.ScrollToLeftEnd方法的具体用法?C# ScrollViewer.ScrollToLeftEnd怎么用?C# ScrollViewer.ScrollToLeftEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.ScrollViewer
的用法示例。
在下文中一共展示了ScrollViewer.ScrollToLeftEnd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: 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();
}