.
Storyboard storyBoardPulse = this.FindResource("StoryboardMainIconPulse") as Storyboard;
Storyboard.SetTarget(storyBoardPulse, this.imageIcon);
if (storyBoardPulse.GetCurrentState() != ClockState.Active)
{
storyBoardPulse.Begin();
}
Hide result:
System.InvalidOperationException
HResult = -2146233079
Message = Unable to complete the action. The storyboard indicates does not apply to this object for interactive control.
Ao I am making a very bloody workaround:
private Boolean pulseOn;
private void operationsOfMaintenance_OperationExpired(Boolean state)
{
Storyboard storyBoardPulse = this.FindResource("StoryboardMainIconPulse") as Storyboard;
Storyboard.SetTarget(storyBoardPulse, this.imageIcon);
if (!state)
{
storyBoardPulse.Stop();
storyBoardPulse.Remove();
pulseOn = false;
}
else
{
if(!pulseOn)storyBoardPulse.Begin();
pulseOn = true;
}
}
Run codeHide resultThere anyboody knows why the first example gets an error!
thank
source
share