Reputation: 46320
I have a user control and I want to create a property of type storyboard which I can set in xaml, so I tried to following, but I get a bad property error when I run it:
private Storyboard sbTransitionIn_m;
public Storyboard TransitionIn
{
get {return sbTransitionIn_m;}
set {sbTransitionIn_m = value;}
}
xaml:
<MyStuff:MyUserControl x:Name="ctlTest" TransitionIn="sbShow"/>
Upvotes: 1
Views: 315
Reputation: 421
Define the storyboard in Resources and then refer it as staticresource
<UserControl.Resources>
<Storyboard x:Key="sbShow">
<!-- -->
</Storyboard>
</UserControl.Resources>
<MyStuff:MyUserControl x:Name="ctlTest" TransitionIn="{StaticResource sbShow}"/>
Upvotes: 2
Reputation: 10785
Storyboard can't serialize from a string attribute like that. Try this:
<MyStuff:MyUserControl x:Name="ctlTest">
<MyStuff:MyUserControl.TransitionIn>
<Storyboard/>
</MyStuff:MyUserControl.TransitionIn>
</MyStuff:MyUserControl>
Upvotes: 1