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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:52:38+00:00 2026-06-15T13:52:38+00:00

I have a C# WPF application where I have several possible images, some having

  • 0

I have a C# WPF application where I have several possible images, some having irregular shapes within the image. I would like to generate different events when clicking on the different shapes within the image.

For example: If the image was of the front of the house, I would genereate different events when clicking on the doorknob, the door, the windows, the roof, etc.

The image has to be resizable.

I can do it manually with a grid and shapes, but it seems like there should be a more elegant way.

I thought I saw a technique where you could make a “shadow” image that was like the original, but with each clickable region filled in a different color. (A “color map” of the clickable regions.) Then the click handler could access the color of the shadow image and raise the appropriate event. However, I couldn’t figure out how to hide the shadow image “under” the display image and still have the click event handler pick up the color.

I’m sure there’s a good way to handle this, I just don’t normally work with images so I’m completely ignorant of it.

Thanks.

  • 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-15T13:52:41+00:00Added an answer on June 15, 2026 at 1:52 pm

    How about having the nice image higher in the Z-order than the “shadow image” and setting topImage.IsHitTestVisible = false;

    This would cause clicks to bypass the top, visible image and go straight to the underlying shadow image click handler.

    Another technique I have used in production code is to derive a new class from Image and override HitTestCore and test the pixel value myself and if it’s a certain color or opacity, I return a different object. This way I control all the action.

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

Sidebar

Related Questions

I have a WPF application with several windows. I would like to define GLOBAL
I have a WPF application containing several ComboBoxes . The ItemsSource of some of
I have a small WPF application where i am displaying an image. I would
I have a WPF Application project with several project references within a single solution
I have a WPF application that includes buttons with PNG images. The actual images
I have a WPF application which has a main window composed from several custom
In my WPF application, I have a Stackpanel containing several controls inside them. How
In my WPF application, I have several models and viewmodels. Consider an example: The
My WPF application includes a resource file MyResources.resx, containing several strings and images. Because
I have a WPF application that looks something like this: The viewmodel wraps the

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.