Esempio n. 1
0
        // This calls onLoaded
        private void SetBookAnchor(object sender, RoutedEventArgs e)
        {
            SetScrollBar();
            ToggleInertia();

            ContentGrid.IsSynchronizedWithCurrentItem = false;

            AccelerSV = ContentGrid.Child_0 <ScrollViewer>(1);

            // Reader may not be available as ContentGrid.OnLoad is faster then SetTemplate
            if (!(Reader == null || Reader.SelectedData == null))
            {
                ContentGrid.ScrollIntoView(Reader.SelectedData, ScrollIntoViewAlignment.Leading);
            }
        }
Esempio n. 2
0
        internal void ContentGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (Reader == null || UserStartReading)
            {
                return;
            }
            UserStartReading = true;

            if (0 < e.AddedItems.Count)
            {
                ContentGrid.ScrollIntoView(e.AddedItems[0]);
            }

            Reader.AutoVolumeAnchor();
        }
Esempio n. 3
0
        private void UpdateContentView(object sender, FileSystemEventArgs e)
        {
            // This has to be done on UI thread.
            syncContext.Send(
                delegate
            {
                ContentGrid.DataContext = CreateContentDataTable(Navigation.CurrentPath);

                //Scroll to the first item. Otherwise, the previous scroll will affect current view.
                if (ContentGrid.Items.Count > 0)
                {
                    ContentGrid.ScrollIntoView(ContentGrid.Items[0]);
                }
            }, null
                );
        }
Esempio n. 4
0
        internal void GotoIndex(int i)
        {
            if (ContentGrid.ItemsSource == null)
            {
                return;
            }
            int l = ContentGrid.Items.Count;

            if (!(-1 < i && i < l))
            {
                return;
            }

            ContentGrid.SelectedIndex = i;
            ContentGrid.ScrollIntoView(ContentGrid.SelectedItem, ScrollIntoViewAlignment.Leading);
            Reader.SelectIndex(i);
            ShowUndoButton();
        }