Have you thought about graying it out using opacity? If you set the opacity to 
about 50%, you will likely get the effect that you want. You can control how it 
grays by putting a rectangle of the appropriate color (white, black, gray) 
directly behind the image...

Eric

-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf 
Of Uriel Cohen
Sent: Thursday, May 10, 2007 3:44 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] Grayscale images in WPF

Hi,

I've been using the Image control in the definition of a XAML UserControl,
and I realized that when I set IsEnabled to false, then the bitmap
displayed in the Image control doesn't get grayed out as I was expecting.

I've been trying to create a similar control (or one that inherits from
Image) that I could use from XAML and bind its properties.
The idea is that I am binding the Source property of my image instance to a
property of a data type that I have created (the property is actually a
string of the location in the disk of the jpg file). So I need the new
control to be able to be binded to.

I tried using a FormatConvertedBitmap instance as the ImageSource of the
Image.Source property, and giving it a BitmapImage instance, but I couldn't
bind the BitmapImage to the path of the image on the disk.
I also though on creating my own BitmapEffect, which would be a better
solution, but these are very complicated to write since you need to meddle
with some unmanaged code and COM interfaces, so I gave up this idea.

Has someone succeded in doing something similar?

I would like to end up with something like a control called
GrayeableImage...

TIA

    Uriel

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to