Silverlight how to implement a property of type StoryBoard
I have a custom control and I want to create a storyboard type property that I can set in the xaml, so I tried to follow, but when I run I get an error with the error:
private Storyboard sbTransitionIn_m;
public Storyboard TransitionIn
{
get {return sbTransitionIn_m;}
set {sbTransitionIn_m = value;}
}
XAML:
<MyStuff:MyUserControl x:Name="ctlTest" TransitionIn="sbShow"/>
+1
Jeremy
source
to share
2 answers
Define storyboard in resources and then specify it as staticresource
<UserControl.Resources>
<Storyboard x:Key="sbShow">
<!-- -->
</Storyboard>
</UserControl.Resources>
<MyStuff:MyUserControl x:Name="ctlTest" TransitionIn="{StaticResource sbShow}"/>
+2
rravuri
source
to share
The storyboard cannot be serialized from the string attribute. Try the following:
<MyStuff:MyUserControl x:Name="ctlTest">
<MyStuff:MyUserControl.TransitionIn>
<Storyboard/>
</MyStuff:MyUserControl.TransitionIn>
</MyStuff:MyUserControl>
+1
Michael S. Scherotter
source
to share