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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:09:10+00:00 2026-05-15T12:09:10+00:00

In my Canvas, I have an image object. I haven’t set a source in

  • 0

In my Canvas, I have an image object. I haven’t set a source in it, but it has coordinates and a size. The tag is:

<Image Canvas.Top=”50″ Canvas.Left=”20″ Height=”68″ Width=”110″ HorizontalAlignment=”Left” Name=”image1″ Stretch=”Fill” VerticalAlignment=”Top” />

Here’s the problem: When I move the mouse over it, I want to find it. With this code:

VisualTreeHelper.FindElementsInHostCoordinates(point, Application.Current.RootVisual)

It won’t find the image unless a source is set. If no source is set, then the image isn’t returned. Does anyone know why? This is causing me problems. I have some drag/drop code and I’m looking to drop something on that Image control, but I need to know when the mouse is over it.

I know there are other ways I could do it (such as placing something else in that location, like a grid or something and detecting that), but that’s not going to work. I can think of several ways that will work, but they’re far less elegant.

If I could get the above to return my image, that would definitely be ideal.

  • 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-15T12:09:11+00:00Added an answer on May 15, 2026 at 12:09 pm

    In your code you had Point point = e.GetPosition(_canvas); This gets the MousePosition co-ordinates in relation to the canvas, but your second line VisualHelper.FindElementsInHostCoordinates(point,Application.Current.RootVisual) is searching in relation to the whole page. You need to change one or the other so they in relation to the same control. I would just change to VisualHelper.FindElementsInHostCoordinates(point,_canvas)

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

Sidebar

Related Questions

I have a function that creates an image with the canvas object. The last
I have an Image inside a Canvas : <Canvas> <Image HorizontalAlignment=Center VerticalAlignment=Center /> </Canvas>
I have an HTML5 canvas image where I've drawn some points and I want
I have some html5 canvas code to make an image, the current fillstyle is
I'm drawing an image to a canvas element. I then have code that depends
I have a canvas element positioned absolutely over a Flash object of the same
I am making an app in which i have to draw image in canvas
Ok, So I have an Image object that I want to rotate around its
I have a canvas on which the background image if first drawn. Then another
I have image inside canvas like following: <Canvas x:Name=cnvMain ClipToBounds=True HorizontalAlignment=Stretch VerticalAlignment=Stretch SnapsToDevicePixels=True> <Image

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.