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 684147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:47:05+00:00 2026-05-14T01:47:05+00:00

Doing the below will reproduce my problem: New WPF Project Add ListView Name the

  • 0

Doing the below will reproduce my problem:

  • New WPF Project
  • Add ListView
  • Name the listview: x:Name=”lvList”
  • Add enough ListViewItems to the ListView to fill the list completely so a vertical scroll-bar appears during run-time.
  • Put this code in the lvList.MouseDoubleClick event

Debug.Print(“Double-Click happened”)

  • Run the application
  • Double-click on the LargeChange area of the scroll-bar (Not the scroll “bar” itself)
  • Notice the Immediate window printing the double-click happened message for the ListView

How do I change this behavior so MouseDoubleClick only happens when the mouse is “over” the ListViewItems and not when continually clicking the ScrollViewer to scroll down/up in the list?

  • 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-05-14T01:47:05+00:00Added an answer on May 14, 2026 at 1:47 am

    You can’t change the behaviour, because the MouseDoubleClick handler is attached to the ListView control, so it has to occur whenever the ListView is clicked — anywhere. What you can do it detect which element of the ListView first detected the double-click, and figure out from there whether it was a ListViewItem or not. Here’s a simple example (omitting error checking):

    private void lv_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
      DependencyObject src = (DependencyObject)(e.OriginalSource);
      while (!(src is Control))
        src = VisualTreeHelper.GetParent(src);
      Debug.WriteLine("*** Double clicked on a " + src.GetType().Name);
    }
    

    Note the use of e.OriginalSource to find the actual element that was double-clicked. This will typically be something really low level like a Rectangle or TextBlock, so we use VisualTreeHelper to walk up to the containing control. In my trivial example, I’ve assumed that the first Control we hit will be the ListViewItem, which may not be the case if you’re dealing with CellTemplates that contain e.g. text boxes or check boxes. But you can easily refine the test to look only for ListViewItems — but in that case don’t forget to handle the case there the click is outside any ListViewItem and the search eventually hits the ListView itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing a homework project that requires this: Below you will find the code
I am doing the below test to try and learn more about LINQ to
I have a method below doing casting on a String according to the given
I am learning C#. Doing the below exercises to make use of features. I
In C# 3.0, I'm doing the code below to declare a DateTime property and
I'm doing a bind to document like below, $(document).bind('click',doThis); But i have a text
What am i doing wrong in the below regular expression matching >>> import re
Can somebody explain to me what the below code is doing. before and after
My code below won't compile. What am i doing wrong? I'm basically trying to
If you look at the method below you will se a declared local class

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.