Storyboards in ResourceDictionary
Posted
by user275561
on Stack Overflow
See other posts from Stack Overflow
or by user275561
Published on 2010-03-30T05:54:13Z
Indexed on
2010/03/30
16:23 UTC
Read the original article
Hit count: 1159
So I would like to move my Storyboards into a ResourceDictionary file and I am having trouble doing that. I have looked everywhere and it involves making the "Resource" sharable but how do I do that in silverlight when there is no x:Shared attribute. Here is the code
<Storyboard x:Key="GreenButtonLight" >
<ColorAnimationUsingKeyFrames BeginTime="00:00:00"
Storyboard.TargetName="GreenBelow"
Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
<SplineColorKeyFrame KeyTime="00:00:00"
Value="#FF75F45D" />
<SplineColorKeyFrame KeyTime="00:00:00.1000000"
Value="#FFA5F796" />
<SplineColorKeyFrame KeySpline="1,0,1,0.06"
KeyTime="00:00:00.5000000"
Value="#FF75F45D" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
Here is what i have in XAML
<Grid.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/ViewResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Grid.Resources>
and here is the Error That i get
Error: Element is already the child of another element.
It only gives me that error when I put in storyboards, nothing else (ex:Styles). I am using Silverlight 3 and not wpf.
© Stack Overflow or respective owner