Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So, i have grid1 (parent) with an image, and grid2 (child) that is on grid1 and with transparent background. Is is possible and how i can blur grid2 background i.e. part of grid1 image, that is under grid2?
Posted

In addition to Solution 1:

You can blur anything with WPF, not just some image. Please see this example: http://www.java2s.com/Tutorial/VB/0290__Windows-Presentation-Foundation/ApplyBlurEffectsonUIElementTextBlock.htm[^].

At the same time, I would like to warn you: don't overuse bitmap effects and other decorative tricks. Good design dictates to avoid distractions. Yes, blurring of some background can be considered as the way to weaken distractions, but then the question is: why your background was made busy in first place? Busy background would be bad at all times, not only when you want to bring the user's attention for some key element.

—SA
 
Share this answer
 
Why are you trying to remove a background from that segment, which is impossible unless you paste any image there.

Since you want to remove the Background property from that section of Grid1 where Grid2 is overlapping, this would take a lot of processing time, to create a runtime event to handle the current position of the Grid2 on the Grid1 and then chop a portion of Grid1 just to make sure that transparency of Grid2 is not affected. So what you can do is to set the Grid2's Background to White instead of Transparent. This way, whereas the Grid2 moves, the Background would move with it, as if you're removing the Background section from Grid1. No need to cut the section of Grid1 now.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 16-Nov-14 13:07pm    
Your idea is not bad, but it looks like you think that you can blur only the image. This is not true. You can blur anything with WPF, including, say, some controls. You will find a simple example here:
http://www.java2s.com/Tutorial/VB/0290__Windows-Presentation-Foundation/ApplyBlurEffectsonUIElementTextBlock.htm.

I'll put another answer.

—SA
Afzaal Ahmad Zeeshan 16-Nov-14 13:15pm    
No, I didn't mean to say non-image controls are not blur-able. What I meant was that to remove a Background from a specific place where the Grid2 is present would be a bad idea. Grid2 is transparent, Grid1 needs to be have no background at the places where Grid2 is overlapping it, so why not add a White Background to the Grid2 that would overlap the Grid1's background.

Wow, too many Grid and Background. -_-
Sergey Alexandrovich Kryukov 16-Nov-14 13:22pm    
All right, but you could make it clear. I up-voted the answer.
Please see my other answer.
—SA
Afzaal Ahmad Zeeshan 17-Nov-14 13:39pm    
Thanks for up-voting, and accept my apology for making you wait for a reply. I was having an exam.

I have editted my answer, and also seen yours. :-) Your precautionary measures are better than mine. So upvoting your answer too.
Sergey Alexandrovich Kryukov 17-Nov-14 13:52pm    
Thank you, Afzaal, and please don't worry about posting timing a bit.
Good luck with your exams.
—SA

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