本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}