Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone!

I'm stuck here in WPF.
I have a textbox (inside a grid) and I want to show an image right on the upper left corner of the textbox overlaying parts of the textbox, like so:

klick here

This is how it looks in HTML (using position:absolute).
Do you see how the red image covers the textbox (of "Name") with a quarter of its size?!

How can I achieve this in WPF?
Posted
Updated 4-Mar-15 5:11am
v2

I would not advise doing such things, because it would compromise text readability, distract and irritate the users.
One trivial way would be this: http://stackoverflow.com/questions/21765677/how-to-overlay-an-image-over-an-image-in-wpf[^].

Instead of video, use image. The trick is to use the same grid and the same row and column. You can also use Canvas. Also, you can make any of the UI elements semi-transparent: https://msdn.microsoft.com/en-us/library/system.windows.uielement.opacity%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 
Here is what I finally did (and it works like a charm):

I'm using a custom Adorner([MSDN]).

All I had to do is replace the "drawEllipse" (and the other brush-stuff) with "drawImage" and adjust the location (using the AdornedElement)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900