У нас есть 3 анимации в раскадровке, которая отлично работает в Silverlight 4, но не работает в Silverlight 5 с вышеупомянутой ошибкой.Анимация довольно проста:
<Storyboard x:Name="categoryChangeStoryboard">
<DoubleAnimation
Storyboard.TargetName="clueTransform"
Storyboard.TargetProperty="ScaleX"
Duration="0:0:0.4"
To="1.05"
RepeatBehavior="3x"
AutoReverse="True"
/>
<DoubleAnimation
Storyboard.TargetName="clueTransform"
Storyboard.TargetProperty="ScaleY"
Duration="0:0:0.4"
To="1.1"
RepeatBehavior="3x"
AutoReverse="True"
/>
<ColorAnimation
Duration="0:0:0.4"
Storyboard.TargetName="categoryForegroundBrush"
Storyboard.TargetProperty="Color"
From="Black"
To="LightGreen"
RepeatBehavior="3x"
AutoReverse="True"
/>
</Storyboard>
и анимируемый объект также довольно прост:
<TextBlock x:Name="clue" Style="{StaticResource labelStyle}" Text="clue" FontSize="35" HorizontalAlignment="Right" MaxWidth="300" TextWrapping="Wrap" VerticalAlignment="Top" FontWeight="Bold" Margin="0,90,80,0" RenderTransformOrigin=".5,.5">
<TextBlock.Foreground>
<SolidColorBrush Color="Black" x:Name="categoryForegroundBrush" />
</TextBlock.Foreground>
<TextBlock.RenderTransform>
<CompositeTransform x:Name="clueTransform"/>
</TextBlock.RenderTransform>
</TextBlock>
Когда мы вызываем
categoryChangeStoryboard.Begin();
Мы получаемследующая ошибка - только для Silverlight 5:
{System.InvalidOperationException: Cannot resolve TargetName categoryForegroundBrush.
at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
at System.Windows.Media.Animation.Storyboard.Begin()
at BCL.FLY.FLYVisual.CoreStateUpdateEvent(Object sender, FLYStateUpdateEventArgs e)
at BCL.FLY.FLYCore.OnStateUpdateEvent(FLYStateUpdateEventArgs e)
at BCL.FLY.FLYCore.Report(String msg, GameEventType t, Butterfly b)
at BCL.FLY.FLYCore.DebugGotoLevel(Int32 i)
at BCL.FLY.FLYVisual.DebugGotoLevel(Int32 n)
at BCL.FLY.FLYGame.GotoLevel(Int32 i)
at C8Live.MainPage.lvlSkip_SelectionChanged(Object sender, SelectionChangedEventArgs e)
at System.Windows.Controls.Primitives.Selector.OnSelectionChanged(SelectionChangedEventArgs e)
at System.Windows.Controls.Primitives.Selector.InvokeSelectionChanged(List`1 unselectedItems, List`1 selectedItems)
at System.Windows.Controls.Primitives.Selector.SelectionChanger.End()
at System.Windows.Controls.Primitives.Selector.NotifyListItemSelected(ListBoxItem listBoxItem, Boolean isSelected)
at System.Windows.Controls.Primitives.Selector.OnIsSelectedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)
at System.Windows.DependencyObject.SetValue(DependencyProperty property, Boolean b)
at System.Windows.Controls.Primitives.Selector.OnListBoxItemClicked(ListBoxItem item)
at System.Windows.Controls.ListBoxItem.OnMouseLeftButtonDown(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonDown(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)}
У кого-нибудь есть мысли?Удаление этой единственной ColorAnimation действительно решает проблему, но мы бы предпочли оставить ее в покое.