I have a stackpanel that has a dynamic amount of images that are added programatically, Is there a way I can set a hover/click effect programatically on these images. I would like for the image to “glow” when clicked. How do i do that in silverlight? I’ve noticed the Image.Effect property, but I’m not really sure how to use it.
I have a stackpanel that has a dynamic amount of images that are added
Share
What you need to do is create a new usercontrol with the image control inside with the visualstates attached to it. This way, you can dynamically add the usercontrol to the stackpanel and have the animations being called without attaching them by events from your main app.
I used the
DropShadowEffecton theImage.Effectto create a pulsating animation.For eg. This is inside your usercontrol:
XAML
C#
Then you can add this usercontrol to your stack panel like so:
Tell me if this works.