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

  • Home
  • SEARCH
  • 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 7868369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:58:39+00:00 2026-06-03T00:58:39+00:00

I have an Image control. When the image is clicked at runtime it should

  • 0

I have an Image control. When the image is clicked at runtime it should be added to a grid as a child. I have implemented this.

My requirement now is when the image (which is now inside a grid) is tapped I need a border around the image. How can I achieve this?

I have added the following code inside image tapped but cannot see the border

Border b = new Border(); 
b.BorderThickness = new Thickness(4); 
img1 = new Image(); 
img1.MaxHeight = 300; 
img1.MaxWidth = 500; 
b.Child = img1; 
img1.Source = new BitmapImage((new Uri(imgPath, UriKind.RelativeOrAbsolute)));
grid1.Children.Add(b);
  • 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-03T00:58:40+00:00Added an answer on June 3, 2026 at 12:58 am

    Instead of droping the image as a grid cell child, create a Border object and put the image inside as a content.

    Initially, the border can have BorderBrush transparent and thickness = 1 or other. Then, add the Tapped event to the image to modify the border brush color.

    Based in your code above, you need something like

    img1.Tapped += delegate(object sender, EventArgs e)
    {
        ((sender as Image).Parent as Border).BorderBrush = Brushes.Blue;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a asp image control. ImageUrl=images/avator.jpg. I'm changing this picture on the server
I have a button and image inside it in my silverlight user control. When
I have a Panel which hosts a number of child controls in a grid
In my application (asp.net) I have an image control which by default has an
I'm putting a WPF application together in which I have an image control which
I have a control: <input id=trigger_update_submit type=image src=images/green_flag.png alt= name=set_this value=uu /> This control
I have an Image control in my Flex application: <mx:Image id=img source=@Embed('img.png') percentHeight=100 percentWidth=100
I have an image control with a source image located in my c drive.
I have a FileUpload Control and a image control on asp.net page as follows
I have an image gallery app that has a slider to control the width

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.