Khushi
Khushi

Reputation: 1051

change the color of the png image using expression blend

There might be duplicates of this question but I didnt find any exact solution to my problem.

I have an image. The source of image is a png image named add.png. The shape of add.png is like a plus(+) symbol. Its color is white at the moment.

I want to change this white color to green when mouse cursor goes over it. So which property of the image should I change to change its color.

I don't want to change the source of image.

Edit :

Why I don't want to change the image source :

Basically I have a rectangle and I keep the image over it. On MouseOver and MouseLeave I change the Fill color of Rectangle using ChangePropertyAction. Now When I click on the image I want to change its source.

But when my program runs I get an error sayin that windows explorer has stopped working. When I see the output window for errors I get System.NullReferenceException: Object reference not set to an instance of an object

Upvotes: 0

Views: 2244

Answers (1)

Samuel
Samuel

Reputation: 6490

It is easier. to change the image source. Your options are limited here: Create own effect by derive from System.Windows.Media.Effects.Effect, call it ColorEffect and implement color change logic there, a similar alternative would be to create separate PixelShader Effect but this is more complex then the Effect above. Use image processing from http://www.codeproject.com/Articles/237226/Image-Processing-is-done-using-WPF

Upvotes: 1

Related Questions