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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:22:19+00:00 2026-05-14T23:22:19+00:00

I have an application with many images that all look the same and perform

  • 0

I have an application with many images that all look the same and perform similar tasks:

<Image Grid.Column="1" Grid.Row="0" Name="image_prog1_slot0" Stretch="Uniform" Source="bullet-icon.png" StretchDirection="Both" MouseDown="image_prog1_slot0_MouseDown"/>
            <Image Grid.Column="1" Grid.Row="1" Name="image_prog1_slot1" Stretch="Uniform" Source="bullet-icon.png" StretchDirection="Both" />
            <Image Grid.Column="1" Grid.Row="2" Name="image_prog1_slot2" Stretch="Uniform" Source="bullet-icon.png" StretchDirection="Both" />

Now, I want to link each one to the same event handler:

private void image_MouseDown(object sender, MouseButtonEventArgs e)
        {
            //this_program = ???;
            //this_slot = ???;
            //slots[this_program][this_slot] = some value;
        }

Obviously the program number and slot number of the image are part of its name. Is there a way to extract this information when the event handler is fired?

  • 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-14T23:22:19+00:00Added an answer on May 14, 2026 at 11:22 pm

    Yes, it is possible.

    As its name suggests, the sender parameter contains the object which fired the event.

    You can also use the Grid‘s attached properties for convenience to determine which row and column it is in. (It is also possible to get other attached properties this way.)

    private void image_MouseDown(object sender, MouseButtonEventArgs e)
    {
        // Getting the Image instance which fired the event
        Image image = (Image)sender;
    
        string name = image.Name;
        int row = Grid.GetRow(image);
        int column = Grid.GetRow(image);
    
        // Do something with it
        ...
    }
    

    Side note:

    You can also use the Tag property to store custom information about controls. (It can store any objects.)

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

Sidebar

Related Questions

I have an application that writes many times to a formula/macro-laden workbook. It loops
I have an application that contains many controls on a panel, each with its
In my application I have many different JSP forms with multiple stages, that is
Right now I have an application that loads a bunch of thumbnail images into
I have to import a large amount of image crops off of many images
I have to use many different images into my windows phone application. Although I
I am creating an application that will have multiple images on the screen, these
I am working on a web application that will deal with many image uploads.
I have an iPad application which has many categorized images I need to switch
I have an application which can accept images as byte data in many different

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.