Пример #1
0
        private void SelectionChangedEventHandler(object sender, SelectionChangedEventArgs args)
        {
            FrameworkElement element = (FrameworkElement)ThumbnailListBox.SelectedItem;

            if (element != null)
            {
                ThumbnailListBox.ScrollIntoView(element);
                //element.BringIntoView(); // this one only works sometimes... because of reasons...
            }
        }
Пример #2
0
 private void ThumbnailLoadedEventHandler(object sender, PdfTools.PdfViewerCSharpAPI.Model.PdfViewerController.ThumbnailsChangedArgs args)
 {
     if (args.ex != null)
     {
         return;
     }
     foreach (ThumbnailItem item in thumbnailItemDict)
     {
         item.OnImageLoaded(args.bitmap, args.pdfPage);
         ThumbnailListBox.InvalidateVisual();
     }
 }
 void ThumbnailListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         var item = e.AddedItems[0] as ListBoxItem;
         ThumbnailListBox.ScrollIntoView(ThumbnailListBox.SelectedItem);
         if (!_isSelectionChangeProgrammatic)
         {
             _viewer.SetCurrentPage((int)item.Tag + 1);
         }
     }
 }
        void UpdateSelectedIndex()
        {
            if (ThumbnailListBox.Items.Count == 0)
            {
                ThumbnailListBox.SelectedIndex = -1;
            }
            else if (ThumbnailListBox.Items.Count < _viewer.GetCurrentPage())
            {
                ThumbnailListBox.SelectedIndex = 0;
            }
            else if (ThumbnailListBox.SelectedIndex != _viewer.GetCurrentPage() - 1)
            {
                ThumbnailListBox.SelectedIndex = _viewer.GetCurrentPage() - 1;
            }

            ThumbnailListBox.ScrollIntoView(ThumbnailListBox.SelectedItem);
            ItemsInViewHitTest();
        }
Пример #5
0
 private void ScrollElementIntoView(ThumbnailItem item)
 {
     ThumbnailListBox.ScrollIntoView(item);
     this.Focus();
 }