動的コードに基づいて「ライトアップ」(不透明度の変更) しようとしている 3 つのポリゴンがあります。たとえば、乱数 (021200112) の長い文字列があります。キーフレームを使用して動的なストーリーボードを作成しようとしています。単一のポリゴンでテストしていますが、ターゲット エラーが発生しています。あなたの助けに感謝します!!!
ポリゴンは XAML で作成されます (Poly1、Poly2、Poly3 という名前)。
ストーリーボードを再生しようとしたときのエラーは次のとおりです。
WinRT information: Cannot resolve TargetProperty 1 on specified object.
poly1 でアニメーションをテストするコードを次に示します。
Public Sub PlayStoryboard()
Dim myDoubleAnimationUsingKeyFrames As New DoubleAnimationUsingKeyFrames()
Dim myLinearDoubleKeyFrame As New LinearDoubleKeyFrame()
Dim myLinearDoubleKeyFrame2 As New LinearDoubleKeyFrame()
myLinearDoubleKeyFrame.Value = 0.2
myLinearDoubleKeyFrame.KeyTime = TimeSpan.FromSeconds(1)
myLinearDoubleKeyFrame2.Value = 1
myLinearDoubleKeyFrame2.KeyTime = TimeSpan.FromSeconds(3)
myDoubleAnimationUsingKeyFrames.KeyFrames.Add(myLinearDoubleKeyFrame)
myDoubleAnimationUsingKeyFrames.KeyFrames.Add(myLinearDoubleKeyFrame2)
myDoubleAnimationUsingKeyFrames.Duration = New Duration(TimeSpan.FromMilliseconds(5000))
Dim myStoryboard = New Storyboard()
myStoryboard.Children.Add(myDoubleAnimationUsingKeyFrames)
Storyboard.SetTarget(myDoubleAnimationUsingKeyFrames, Poly1)
Storyboard.SetTargetName(myDoubleAnimationUsingKeyFrames, Poly1.Name)
Storyboard.SetTargetProperty(myDoubleAnimationUsingKeyFrames, Opacity)
myStoryboard.Begin()
End Sub