コード例 #1
0
 public AutoScroller(ItemsControl itemsControl)
 {
     if (itemsControl == null)
     {
         throw new ArgumentNullException("itemsControl");
     }
     this.itemsControl = itemsControl;
     this.scrollViewer = ListBoxDragSelectionBehavior.FindChild <ScrollViewer>(itemsControl);
     this.scrollViewer.ScrollChanged += new ScrollChangedEventHandler(this.OnScrollChanged);
     this.scrollContent       = ListBoxDragSelectionBehavior.FindChild <ScrollContentPresenter>(this.scrollViewer);
     this.autoScroll.Tick    += new EventHandler((object param0, EventArgs param1) => this.PreformScroll());
     this.autoScroll.Interval = TimeSpan.FromMilliseconds((double)ListBoxDragSelectionBehavior.AutoScroller.GetRepeatRate());
 }
コード例 #2
0
 private bool Register()
 {
     this.scrollContent = ListBoxDragSelectionBehavior.FindChild <ScrollContentPresenter>(this.listBox);
     if (this.scrollContent != null)
     {
         this.autoScroller = new ListBoxDragSelectionBehavior.AutoScroller(this.listBox);
         this.autoScroller.OffsetChanged += new EventHandler <ListBoxDragSelectionBehavior.OffsetChangedEventArgs>(this.OnOffsetChanged);
         this.selectionRect = new ListBoxDragSelectionBehavior.SelectionAdorner(this.scrollContent);
         this.scrollContent.AdornerLayer.Add(this.selectionRect);
         this.selector = new ListBoxDragSelectionBehavior.ItemsControlSelector(this.listBox);
         this.listBox.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.OnPreviewMouseLeftButtonDown);
         this.listBox.MouseLeftButtonUp          += new MouseButtonEventHandler(this.OnMouseLeftButtonUp);
         this.listBox.MouseMove += new MouseEventHandler(this.OnMouseMove);
     }
     return(this.scrollContent != null);
 }