Exemplo n.º 1
0
        private async void setContent()
        {
            Route route = routes[routeIndex];

            if (stop == route.TravelRoute.Last().Stop)
            {
                this.stop = route.TravelRoute.First().Stop;
            }

            var list = route.TravelRoute
                       .Select(e => new TimeStopListModel <StopGroup> {
                Time = e.Time.ToString(), Stop = e.Stop
            })
                       .ToList();

            list.Last().Disabled = true;

            ContentListView.ItemsSource = list;
            changeContent();

            await Task.Delay(100);

            int current = list.IndexOf(list.First(x => x.Position == 0));
            int ind     = Math.Max(0, current - 4);

            if (ind != 0)
            {
                ContentListView.ScrollTo(list[ind]);
            }
        }
Exemplo n.º 2
0
        private void ContentListView_Loaded(object sender, RoutedEventArgs e)
        {
            int lineNo = ViewModel.CurrentLineNo;

            if (ContentListView.ItemsSource.Count > 0 && ContentListView.ItemsSource.Count > lineNo)
            {
                Dispatcher.BeginInvoke(() => ContentListView.ScrollTo(ContentListView.ItemsSource[lineNo]));
            }
            else
            {
                throw new System.IndexOutOfRangeException("ContentListView don't have a line at No." + lineNo);
            }
        }
Exemplo n.º 3
0
        private async void ViewModel_ScrollIntoViewRequired(object sender, object scrollTargetItem)
        {
            await Task.Delay(100);

            ContentListView.ScrollTo(scrollTargetItem);
        }
Exemplo n.º 4
0
 void ContentListView_ItemRealized_ScrollToCurrentLine(object sender, ItemRealizationEventArgs e)
 {
     ContentListView.ItemRealized -= ContentListView_ItemRealized_ScrollToCurrentLine;
     ContentListView.ScrollTo(ContentListView.ItemsSource[ViewModel.CurrentLineNo - 1]);
 }