I’m looking at the ComboBox template.
I have a StoryBoard that I’m creating in code, and I want to animate something in the ComboBox with it. It works fine if I just want to do a property, like “Background”, but what is the right way to animate a template part like, for instance, the Rectangle named Highlight?
I’ve tried setting the property path to (ComboBox).(Highlight).(Rectangle.Fill).(SolidBrush.Color) but that gives me an error saying it can’t resolve that on the given object.
edit: It looks like WPF has some overloads on StoryBoard.Begin() that make this easy, but I don’t see anything like that for Silverlight 4
edit2: and to clarify, I’m trying to do this on a default Silverlight ControlTemplate, not one I’m defining myself (I’d like to avoid copying that template into my codebase)
Override the
OnApplyTemplatemethod and see if you can attach the storyboard programmatically to the actual template part at that time. You useGetTemplateChildto retrieve the template parts.