c# - Pausing a storyboard on TabItem mouse over -
i have tab control invisible tabs.
when mouse on area of form, calls c# handler runs:
((storyboard)findresource("animate")).begin(hiddentab);
the animate storyboard:
<storyboard x:key="animate"> <objectanimationusingkeyframes begintime="0:0:0" storyboard.targetproperty="visibility"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>visible</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> <doubleanimation begintime="0:0:0.0" storyboard.targetproperty="opacity" from="0" to="1" duration="0:0:0.2"/> <doubleanimation begintime="0:0:2.5" storyboard.targetproperty="opacity" from="1" to="0" duration="0:0:0.5"/> <objectanimationusingkeyframes begintime="0:0:5.5" storyboard.targetproperty="visibility"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>hidden</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> </storyboard>
now want pause animation when mouse on tab item, , resume animation when mouse leaves tab item.
i applied eventsetter
s tab items via controltemplate call:
((storyboard)findresource("animate")).pause(hiddentab);
but says cannot find animate
within tabitem controltemplate, makes sense since animate
defined window resource.
how can access storyboard can pause/resume?
try using code access resource in wpf
object res1 = this.resources["animate"];
type cast story board , see if helps.
Comments
Post a Comment