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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:34:45+00:00 2026-06-10T01:34:45+00:00

I have a Canvas on which I have dynamically added some shapes. I now

  • 0

I have a Canvas on which I have dynamically added some shapes. I now want to add an Image over the canvas.

Everything works fine, if I add Image out of Canvas but when I am trying to add the Image on the Canvas, the image is not showing up. Maybe it is hidden behind the Shapes drawn on Canvas.

My question is how can I bring the Image in front of the Canvas.

This is how I am adding image :

string strUri2 = String.Format(@"pack://application:,,,/MyFirstWPF;component/Images/tt.jpg");
image1.Source = new BitmapImage(new Uri(strUri2));

Note-> the shapes on canvas are added before adding the image.

  • 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-10T01:34:46+00:00Added an answer on June 10, 2026 at 1:34 am

    You can do this 2 ways:

    • change the Z-Index of the Image to bring it to the front of the Z-Order on the Canvas
    • use a container that allows the Canvas to be overlaid with the Image element (e.g a Grid)

    If you use the Z-Index method with the Canvas then to do it properly you have to concern yourself with the Z-Index of other elements on the Canvas….because you have to choose a Z-Index value that is bigger than everything else.

    You could guess, and just pick a large Z-Index which you think will never be reached by the other elements, or you could scan through the children of the Canvas and find the highest Z-Index used, so that you can always set a higher one….so that you can ensure you “Bring to Front” the Image.

    • BringToFront in WPF

    (this is probably the same as what you were using when you say “Out of Canvas”)

    There’s an alternative way which means you don’t have to explicitly bother with Z-Indexes, just use a Grid and specify the Canvas and Image as children…they will occupy the same cell, and so overlap each other…the Image being the last child will have the largest implied Z-Index.

    <Grid>
        <Canvas x:Name="mycanvas"/>
        <Image x:Name="image1/>
    </Grid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few internal Canvas xaml files which I want to load dynamically
I have created a basic shape in HTML canvas element which works fine. The
I have a canvas which contains specific usercontrols. At some point, I want to
In my WPF application I have a Canvas in which I do some drawing.
I have a scenario where I want to dynamically add words of text to
I have a canvas on which the background image if first drawn. Then another
I have a flex 3 application that creates an Image from a canvas which
I have a canvas control which I'm housing a shape and some text in.
I have a canvas onto which I draw shapes like rectangle etc. When I
I have a canvas which user can interact to make changes to design. Now

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.