2012-10-02 56 views
0

如何在運行時爲DoubleAnimationUsingKeyFrames設置TargetName?Windows Phone - 運行時Storyboard TargetName

<Storyboard x:Name="sr"> 
    <DoubleAnimationUsingKeyFrames x:Name="keyFrameDA" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="cardBack"> 
     <EasingDoubleKeyFrame KeyTime="0" Value="0"/> 
     <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/> 
    </DoubleAnimationUsingKeyFrames> 
</Storyboard> 

我已經試過

Storyboard.SetTargetName(keyFrameDA, "cardBack"); 

但沒有對DoubleAnimationUsingKeyFrames這些財產。謝謝。

更新: 而這個錯誤是,當我使用這個代碼拋出:

Storyboard.SetTargetProperty(keyFrameDa, new PropertyPath(PlaneProjection.RotationXProperty)); 
Storyboard.SetTarget(keyFrameDa, cardBack.Projection); 

錯誤:KeyFramesProperty - 無法獲取字段的值「KeyFramesProperty」,因爲關於包含類信息不可用。

回答

0

好了,這個怎麼樣?

Storyboard.SetTargetProperty(keyFrameDa, new PropertyPath(PlaneProjection.RotationXProperty)); 
Storyboard.SetTarget(keyFrameDa, cardBack.Projection); 
+0

編譯錯誤...... –

+0

編輯......對不起,不是一臺機器,我可以做一個試驗編譯。 –

+0

謝謝。在我看來,它必須奏效。但是它在第一行給出「值不能爲空。 參數名稱:元素」錯誤。 –

相關問題