Hi,
I have a simple xaml that has a custom style for a button, and a storyboard to animate the button (refering to elements introduced in the style - panels, brushes, etc). I want to execute the storyboard on a button instance from code, so I retrieve the storyboard with FindResource and try calling its Begin() method on the button instance - I get an exception that the name one of the style elements (for example "panel1") cannot be found :(. Everything works great if i refer to the storyboard via <StaticResource> in an <EventTrigger>
What is the correct way to resolve this situation
Thanx.

Using a static resource storyboard from code
MSP.Saami
hi,
was there a solution here ,
I would be very grateful !
eg. Ed you say
"If you are using a Template, you may need to pass that in to the Begin storyboard call.
"
Will you show an example please
many thanks,
craig kelly-soens
Swapna.B.
<
Storyboard x:Key="sb1" Storyboard.TargetName="MySolidColorBrush" Storyboard.TargetProperty="Color"><
ColorAnimation BeginTime="0:0:0" From="white" To="green" Duration="0:0:2"></ColorAnimation></
Storyboard><
ControlTemplate x:Key="qa1" TargetType="{x:Type Button}"><
Border Width="200" BorderBrush="Black" BorderThickness="2"><
TextBlock Name="mytxt" ><
TextBlock.Background><
SolidColorBrush x:Name="MySolidColorBrush" Color="green" /></
TextBlock.Background><
ContentPresenter/></
TextBlock></
Border></
ControlTemplate>Storyboard sb = this.FindResource("sb1") as Storyboard;
this.RegisterName("MySolidColorBrush",btns.Template.FindName("MySolidColorBrush",btns));
sb.Begin(btns);
William Bartholomew