예제 #1
0
        /// <summary>
        /// Handles the SelectionChanged event of the ReorderableListBox control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
        private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.dragging && !this.dragItemSelected)
            {
                this.dragItemSelected  = true;
                this.originalItemIndex = this.SelectedIndex;

                ListBoxItem listBoxItem = (ListBoxItem)ItemContainerGenerator.ContainerFromIndex(SelectedIndex);

                this.overlayElement = new DropPreviewAdorner((UIElement)this, listBoxItem);

                this.overlayElement.Visibility = Visibility.Collapsed;
                this.AdornerLayer.Add(this.overlayElement);
            }
        }
예제 #2
0
        /// <summary>
        /// Handles the SelectionChanged event of the ReorderableListBox control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
        private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.dragging && !this.dragItemSelected)
            {
                this.dragItemSelected = true;
                this.originalItemIndex = this.SelectedIndex;

                ListBoxItem listBoxItem = (ListBoxItem)ItemContainerGenerator.ContainerFromIndex(SelectedIndex);

                this.overlayElement = new DropPreviewAdorner((UIElement)this, listBoxItem);

                this.overlayElement.Visibility = Visibility.Collapsed;
                this.AdornerLayer.Add(this.overlayElement);
            }
        }