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 has many different types of objects that each persist
I have inherited a VB6/Access application that we have developed and sold for many
I have a legacy VB6 application that was built using MSDE. As many client's
I have an application where I have potentially many processes must send a message
I imagine there are many of you out there who have developed an application
We have a project with many dll files which get loaded when the application
When designing an application, does there come a point where you have too many
Many applications have grids that display data from a database table one page at
In my application, a user has_many tickets. Unfortunately, the tickets table does not have
I have a few C# .dll projects which are common to many applications. Currently,

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.