Search code examples
c#silverlightxamlsilverlight-4.0visualstatemanager

Override a visualstate in a style without overriding the controltemplate


I'm trying to tweak an existing (rather complex) control just a little bit. So far I can make the changes all in the style, apart from some tweaks to the animations. I know I can override the controltemplate in the style and change the VisualStateManager stuff there, but I really don't want to touch it's template. Does anyone know of a way to change a VisualState through a Style without having to duplicate the full ControlTemplate? (Or does anyone know for sure it can't be done?)


Solution

  • You have to be in the ControlTemplate to reference controls and their properties to animate them during a state change, so yes you have to copy the control template. How else would you be able to specify what you actually want to change for a particular state?