views:

17

answers:

1

I have a storyboard here in XAML using Microsoft expression Blend and I am wanting to call this storyboard in C# and I have researched for a day or so and I cannot seem to find the answer. I am at this point

<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();   
}

This actually compiles, which is more than a lot of the rest of help i found would do, but when I click the button that this method is about, my program goes to not-responding. Can anyone help out a little bit?

A: 

Neverymind ... i figured it out...the spaces in the this.FindResource(" LoginClose ") isn't accurate with those blank spaces in there. Just made it ("LoginClose") and the storyboard works just fine

Sammy