1

Topic: To anchor parameter in Storyboard to property in code-behind

Is at me Lookless control in ControlTemplate. Resources which is Stoyboard added through Blend: <Storyboard x:Key = "InProgressMarkStoryboard"> <Storyboard. Children> <DoubleAnimationUsingKeyFrames Storyboard. TargetProperty = "(UIElement. RenderTransform). (TransformGroup. Children) [2]. (RotateTransform. Angle)" Storyboard. TargetName = "inprogressMark" RepeatBehavior = "Forever"> <EasingDoubleKeyFrame KeyTime = "0:0:1" Value = "360"/> </DoubleAnimationUsingKeyFrames> </Storyboard. Children> </Storyboard> very much it would be desirable to anchor property Value to Dependency propertie appropriate type in code-behind, type such:... <EasingDoubleKeyFrame KeyTime = "0:0:1" Value = "{TemplateBinding InProgressMarkRotationPerSecond}"/>... However at attempt to be anchored to property I receive XamlParseException. All it generated at me not good thoughts that or it is impossible to use bindings in resources, or all the matter is that Storyboard "is frozen" (IsFrozen == true). Tried to change parameters Storyboard in method OnApplyTemplate so: EasingDoubleKeyFrame keyFrame = ((Template. Resources ["InProgressMarkStoryboard"] as Storyboard).Children [0] as DoubleAnimationUsingKeyFrames).KeyFrames [0] as EasingDoubleKeyFrame; keyFrame. SetValue (EasingDoubleKeyFrame. ValueProperty, InProgressMarkRotationPerSecond); However here too there are problems because of that that Storyboard "is frozen". Basically  does not hinder to make new Storyboard or it is simple DoubleAnimation and to "connect" it to demanded property. However in this case it will be impossible to see in Blend preview a control item that it would not be desirable. In connection with these questions the following: It is possible or is impossible to use a binding in resources? As it is possible to anchor Storyboard from ControlTemplate. Resources to property  thus without replacing Storyboard?