Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:30:51+00:00 2026-06-05T19:30:51+00:00

I have a ListBox with multiple selection. And I am doing drag and drop

  • 0

I have a ListBox with multiple selection. And I am doing drag and drop operation in it. I used Ctrl+A to select all items. But once I have click an item to start drag, items got deselected. Is there any way to select/deselect listboxitem on mouse up.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:30:53+00:00Added an answer on June 5, 2026 at 7:30 pm

    The ListBoxItem overrides its OnMouseLeftButtonDown and invokes a method on the containing ListBox that handles the selection. So if you want to mouse down on a selected listbox item and initiate a drag you will need to start that before this happens on the ListBoxItem. So you might try handling the PreviewMouseLeftButtonDown on the ListBox and checking the e.OriginalSource. If that is a ListBoxItem or an element within the listbox item (you’ll need to walk up the visual tree) then you can initiate your drag operation. E.g.

    private void OnPreviewLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        var source = e.OriginalSource as DependencyObject;
    
        while (source is ContentElement)
            source = LogicalTreeHelper.GetParent(source);
    
        while (source != null && !(source is ListBoxItem))
            source = VisualTreeHelper.GetParent(source);
    
        var lbi = source as ListBoxItem;
    
        if (lbi != null && lbi.IsSelected)
        {
            var lb = ItemsControl.ItemsControlFromItemContainer(lbi);
            e.Handled = true;
            DragDrop.DoDragDrop(....);
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Listbox that allows user to select multiple items. Normally user can
I have a ListBox that can have multiple items selected at once. I have
I have a multiple selection listbox in which I insert items using javascript. At
I have a WPF ListBox that I would like to Enable multiple selection in
I have a listbox that a user can select multiple values from . each
I have a ListBox which is made up of Grid Items in Multiple SelectionMode
I would like to make a multiple selection listbox in HTML that can have
I have a webpart and I want to select mulitple items in a listbox,pretty
I have a multiple selection listbox on a web form which lists various internal
I have a ListBox with SelectionMode=Multiple, which allows me to select multiple rows by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.