예제 #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...
            }
        }
 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();
        }
예제 #4
0
 private void ScrollElementIntoView(ThumbnailItem item)
 {
     ThumbnailListBox.ScrollIntoView(item);
     this.Focus();
 }