Name SmoothScroll methods with Async
This commit is contained in:
Родитель
2ebe4b2fec
Коммит
91367b8b85
|
@ -3,7 +3,7 @@
|
|||
using Microsoft.Toolkit.Uwp.UI;
|
||||
|
||||
// Scrolling with index
|
||||
await MyGridView.SmoothScrollIntoViewWithIndex(index: int, itemPlacement: ItemPlacement, disableAnimation: bool, scrollIfVisibile: bool, additionalHorizontalOffset: int, additionalVerticalOffset: int);
|
||||
await MyGridView.SmoothScrollIntoViewWithIndexAsync(index: int, itemPlacement: ItemPlacement, disableAnimation: bool, scrollIfVisibile: bool, additionalHorizontalOffset: int, additionalVerticalOffset: int);
|
||||
|
||||
// Scrolling with item
|
||||
await MyGridView.SmoothScrollIntoViewWithItem(item: object, itemPlacement: ItemPlacement, disableAnimation: bool, scrollIfVisibile: bool, additionalHorizontalOffset: int, additionalVerticalOffset: int);
|
||||
await MyGridView.SmoothScrollIntoViewWithItemAsync(item: object, itemPlacement: ItemPlacement, disableAnimation: bool, scrollIfVisibile: bool, additionalHorizontalOffset: int, additionalVerticalOffset: int);
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
|
|||
var scrollIfVisibile = scrollIfVisibileInput.IsChecked ?? true;
|
||||
var additionalHorizontalOffset = int.TryParse(additionalHorizontalOffsetInput.Text, out var ho) ? ho : 0;
|
||||
var additionalVerticalOffset = int.TryParse(additionalVerticalOffsetInput.Text, out var vo) ? vo : 0;
|
||||
sampleListView.SmoothScrollIntoViewWithIndex(index, itemPlacement, disableAnimation, scrollIfVisibile, additionalHorizontalOffset, additionalVerticalOffset);
|
||||
sampleListView.SmoothScrollIntoViewWithIndexAsync(index, itemPlacement, disableAnimation, scrollIfVisibile, additionalHorizontalOffset, additionalVerticalOffset);
|
||||
});
|
||||
|
||||
if (sampleListView != null)
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Microsoft.Toolkit.Uwp.UI
|
|||
/// <param name="additionalHorizontalOffset">Adds additional horizontal offset</param>
|
||||
/// <param name="additionalVerticalOffset">Adds additional vertical offset</param>
|
||||
/// <returns>Note: Even though this return <see cref="Task"/>, it will not wait until the scrolling completes</returns>
|
||||
public static async Task SmoothScrollIntoViewWithIndex(this ListViewBase listViewBase, int index, ItemPlacement itemPlacement = ItemPlacement.Default, bool disableAnimation = false, bool scrollIfVisible = true, int additionalHorizontalOffset = 0, int additionalVerticalOffset = 0)
|
||||
public static async Task SmoothScrollIntoViewWithIndexAsync(this ListViewBase listViewBase, int index, ItemPlacement itemPlacement = ItemPlacement.Default, bool disableAnimation = false, bool scrollIfVisible = true, int additionalHorizontalOffset = 0, int additionalVerticalOffset = 0)
|
||||
{
|
||||
if (index > (listViewBase.Items.Count - 1))
|
||||
{
|
||||
|
@ -199,9 +199,9 @@ namespace Microsoft.Toolkit.Uwp.UI
|
|||
/// <param name="additionalHorizontalOffset">Adds additional horizontal offset</param>
|
||||
/// <param name="additionalVerticalOffset">Adds additional vertical offset</param>
|
||||
/// <returns>Note: Even though this return <see cref="Task"/>, it will not wait until the scrolling completes</returns>
|
||||
public static async Task SmoothScrollIntoViewWithItem(this ListViewBase listViewBase, object item, ItemPlacement itemPlacement = ItemPlacement.Default, bool disableAnimation = false, bool scrollIfVisibile = true, int additionalHorizontalOffset = 0, int additionalVerticalOffset = 0)
|
||||
public static async Task SmoothScrollIntoViewWithItemAsync(this ListViewBase listViewBase, object item, ItemPlacement itemPlacement = ItemPlacement.Default, bool disableAnimation = false, bool scrollIfVisibile = true, int additionalHorizontalOffset = 0, int additionalVerticalOffset = 0)
|
||||
{
|
||||
await SmoothScrollIntoViewWithIndex(listViewBase, listViewBase.Items.IndexOf(item), itemPlacement, disableAnimation, scrollIfVisibile, additionalHorizontalOffset, additionalVerticalOffset);
|
||||
await SmoothScrollIntoViewWithIndexAsync(listViewBase, listViewBase.Items.IndexOf(item), itemPlacement, disableAnimation, scrollIfVisibile, additionalHorizontalOffset, additionalVerticalOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче