2010-10-20 19 views
1

C#代碼調用我使用Microsoft Expression Blend將在這裏有一個故事板在XAML,我想叫這個故事板在C#中,我已經研究了一天左右,我似乎無法找到答案。我在這一點上試圖讓一個XAML創建情節串連圖板在後面

XAML:

<UserControl.Resources> 
    <Storyboard x:Key="LoginClose"> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="LoginControl"> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/> 
     </DoubleAnimationUsingKeyFrames> 
     <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="LoginControl"> 
      <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/> 
     </DoubleAnimationUsingKeyFrames> 
     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="LoginControl"> 
      <DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="{x:Static Visibility.Visible}"/> 
      <DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Collapsed}"/> 
     </ObjectAnimationUsingKeyFrames> 
    </Storyboard> 
</UserControl.Resources> 

代碼背後:

private void btnClose_Click(object sender, System.Windows.RoutedEventArgs e){   
    Storyboard Test = this.FindResource(" LoginClose ") as Storyboard; 
    Test.Begin(); 
} 

這實際上編譯,這是不是一個很大的幫助其餘的我發現了更多的會但是當我點擊這個方法的關鍵時,我的程序就會不響應。任何人都可以幫助一下嗎?

+1

Neverymind ......我理解了它......在this.FindResource(「LoginClose」)的空間是不準確的,在那些有空白。剛做成它(「LoginClose」),故事板運行良好 – Sammy 2010-10-20 14:23:40

回答

1

Neverymind ......我理解了它......在this.FindResource(「LoginClose」)的空間是不準確的,在那裏這些空格。只是做它(「LoginClose」)和故事板工作得很好

相關問題