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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:10:35+00:00 2026-05-11T06:10:35+00:00

I am responding to MouseLeftButtonDown events on elements added to a WPF canvas. It

  • 0

I am responding to MouseLeftButtonDown events on elements added to a WPF canvas. It all works fine when clicked (i.e. the eventhandler fires off correctly), but it requires too much precision from the mouse pointer. You have to be perfectly on top of the circle to make it work. I need it to be a little more forgiving; maybe at least 1 or 2 pixles forgiving. The elements on the canvas are nice big circles (about the size of a quarter on the screen), so the circles themselves are not too small, but the StrokeWidth of each one is 1, so it is a thin line.

You can see a screenshot here: http://twitpic.com/1f2ci/full

Most graphics app aren’t this picky about the mouse picking, so I want to give the user a familiar experience.

How can I make it a little more forgiving.

  • 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. 2026-05-11T06:10:35+00:00Added an answer on May 11, 2026 at 6:10 am

    You can hook up to the MouseLeftButtonDown event of your root layout object instead, and check which elements is in range of a click by doing this:

    List<UIElement> hits = System.Windows.Media.VisualTreeHelper.FindElementsInHostCoordinates(Point, yourLayoutRootElement) as List<UIElement>;   

    http://msdn.microsoft.com/en-us/library/cc838402(VS.95).aspx

    For the Point parameter, you can use the MouseEventArgs parameter e, and call its GetPosition method like this:

    Point p = e.GetPosition(null) 

    I can’t remember whether to use HitTest instead of the FindElementsInHostCoordinates. Try both.
    http://msdn.microsoft.com/en-us/library/ms608752.aspx

    You could create 4 Point objects from the mouse position to create a fake tolerence effect, and call either FindElementsInHostCoordinates or HitTest for all 4 points.

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

Sidebar

Related Questions

I'm newbie in Android application development. I just downloaded all SDks and Eclispe. Then
I am running a query that returns ~30,000 rows from a C# TableAdapter, and
I use lua 5.1 and the luaSocket 2.0.2-4 to retrieve a page from a
I have a JSP Project, running on Tomcat locally and on Glassfish on the
I've been trying to return special characters from an AJAX request to a PHP
I have a universal binary application and currently working on the iPad version of
I have a fairly simple HTML page with a link on it that calls
Silverlight 3 now contains built in browser zoom support. The current problem I am
FIXED : SEE BELOW ok. so here's my app. http://libwiki.heroku.com/libraries if you view it
I have a UIScrollView which content is designed with Interface Builder. It has a

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.