This project has moved. For the latest updates, please go here.

Possible bug in attached property?

Mar 11, 2009 at 10:48 PM
If I change the image source of an Image that has IsEnabled = false and it has IsGreyable attached property set to true, then enable the image, the image displays the old source. I can work around this by setting the IsGreyable property to false, changing the source, and setting isGreyable to true again.
Sep 8, 2009 at 11:36 AM

Issue fixed. The problem was that I used the SourceUpdate event from Image assuming it fires when Source property is changed, but SourceUpdate is inherited from FrameworkElement and has nothing to do with Image.Srouce

Nov 4, 2009 at 5:17 PM
Edited Nov 4, 2009 at 5:35 PM

There is another issue there, that is not a bug per se, but is still a problem. If there is a Style property set on an image and there are triggers in it setting a Source or an OpacityMask - neither Source nor OpacityMask are set even though triggers themselves are executed. This is because both GreyableImage and attached IsGreyable property are manipulating Source property of the image from code - thus effectively overwriting anything that comes from triggers. This is happening because "local value" of the property has precedence over style triggers - this is explained in detail in "Dependency Property Value Precedence" MSDN article.

Look at the Window7 example in Test project.