Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8093887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:36:48+00:00 2026-06-05T20:36:48+00:00

I have a simple MVVM application. It contains a property, which I will change

  • 0

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 not. 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 >
  <StatusBar.Resources>
    <Storyboard x:Key="StatusBar" >
      <DoubleAnimationUsingKeyFrames 
                    Storyboard.TargetProperty="(UIElement.Opacity)" 
                    Storyboard.TargetName="statusBarItem">
        <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"/>
      </DoubleAnimationUsingKeyFrames>
    </Storyboard>
  </StatusBar.Resources>
</StatusBar>  

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

<UserControl.Resources>

<DataTemplate.Triggers>

</DataTemplate.Triggers>

</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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:36:51+00:00Added an answer on June 5, 2026 at 8:36 pm

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

    <Grid>
        <Grid.DataContext>
            <WpfApplication1:MainViewModel/>
        </Grid.DataContext>
    
        <Grid.Resources>
            <Style x:Key="statusStyle" TargetType="StatusBar">
                <Setter Property="Opacity" Value="0"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Pulse}" Value="True">
                        <DataTrigger.EnterActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimationUsingKeyFrames 
                                        AutoReverse="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"/>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </BeginStoryboard>
                        </DataTrigger.EnterActions>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
    
        <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" />
    </Grid>
    

    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); }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple MVVM Light application which has a textblock and a
I have a simple WPF application where I don't have any mvvm framework like
I am programming WP7 application adhering the MVVM pattern. I have ViewModelLocator which ensures
I am working to create a simple CRUD application in WPF which will work
I have pretty simple scenario (MVVM) DataTemplate visuals should change based on data I
I'm just playing around with WPF and MVVM, and I have made a simple
I have simple class with width and height member fields which define number of
I have simple win service, that executes few tasks periodically. How should I pass
I am implementing a simple MVVM WPF application with simple databrowsing commands. There is
I have a WPF application using MVVM. I have some user controls that show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.