Ejemplo n.º 1
0
        // Works around ScrollIntoView() not implemented for all platforms
        private static void ScrollBy(ListViewBase listViewBase, double scrollBy)
        {
            var sv = listViewBase.FindFirstChild <ScrollViewer>();

            Assert.IsNotNull(sv);
            sv.ChangeView(null, scrollBy, null);
        }
Ejemplo n.º 2
0
        private static async Task ScrollByInIncrements(ListViewBase listViewBase, double scrollBy)
        {
            var sv = listViewBase.FindFirstChild <ScrollViewer>();

            Assert.IsNotNull(sv);
            var current = sv.VerticalOffset;

            if (current == scrollBy)
            {
                return;
            }
            var increment = sv.ActualHeight / 2;

            if (increment == 0)
            {
                Assert.Fail("ScrollViewer must have non-zero height");
            }
            if (scrollBy > current)
            {
                for (double d = current + increment; d < scrollBy; d += increment)
                {
                    sv.ChangeView(null, d, null);
                    await Task.Delay(10);
                }
            }
            else
            {
                for (double d = current - increment; d > scrollBy; d -= increment)
                {
                    sv.ChangeView(null, d, null);
                    await Task.Delay(10);
                }
            }

            sv.ChangeView(null, scrollBy, null);
        }