Trying to begin a storyboard on change of a property in WPF application

I have a simple MVVM application. It contains a property, which I will change to true when a method correctly executes, and false if it does now. When this property changes, for a few seconds I would like to display "Passed" or "Failed" on the status bar of my WPF application and then have it fade away.

So I have read StackOverflow, and Googled intensely, to no avail. I think I have misunderstood how I need to structure the Storyboard.

In my StatusBar I have added a storyboard, which I am trying to trigger in <UserControl.Resources> at the beginning of my XAML file. Is this correct ? At the moment I am using dummy values of 0/1, I assume the correct practice would be to use a BooleanToString converter I could make, or perhaps there is a better way?

So my status bar contains :

<StatusBar >
    <Storyboard x:Key="StatusBar" >
        <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
        <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"/>
        <EasingDoubleKeyFrame KeyTime="0:0:3" Value="1"/>
        <EasingDoubleKeyFrame KeyTime="0:0:4" Value="0"/>

and I am trying to register for this to be called in my UserControl.Resources :

Do I have my structure completely backwards ? It will not compile and I get the error :

A value of type 'BeginStoryboard' cannot be added to a collection or dictionary of type 'SetterBaseCollection'. 

Any help, resources or information would be very much appreciated. Thanks a lot.


Here's an example. You need to use a trigger to start the storyboard.


        <Style x:Key="statusStyle" TargetType="StatusBar">
            <Setter Property="Opacity" Value="0"/>
                <DataTrigger Binding="{Binding Pulse}" Value="True">
                                    Storyboard.TargetProperty="(UIElement.Opacity)" >
                                    <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                    <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"/>
                                    <EasingDoubleKeyFrame KeyTime="0:0:3" Value="1"/>
                                    <EasingDoubleKeyFrame KeyTime="0:0:4" Value="0"/>
        <RowDefinition Height="auto"/>

    <StatusBar Style="{StaticResource statusStyle}" 
                       Grid.Row="1" ItemsSource="{Binding Items}" />
    <CheckBox Content="CheckBox" Height="16" 
                      HorizontalAlignment="Left" Margin="41,30,0,0" 
                      IsChecked="{Binding Pulse}" VerticalAlignment="Top" />

View model

public class MainViewModel : ViewModelBase
    private bool _pulse;

    public MainViewModel()
        Items = new[] {"Passed"};

    public IList<string> Items { get; private set; }

    public bool Pulse
        get { return _pulse; }
        set { Set(()=>Pulse, ref _pulse, value); }

Need Your Help

LINQ: Order By Count of most common value

c# linq lambda

I'm trying to create an "ordered" List of objects in c#, where the list will be ordered by the most common occurrences of values in ImdbId property.

Cannot create JDBC driver of class '' for connect URL 'null'

java postgresql tomcat jndi

I'm using Tomcat 7.0.12 and receiving this error whenever I attmept to access a JNDI datasource connecting to a postgresql db via a .jsp page in a webapp called 'ROOT':