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 8403947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:28:07+00:00 2026-06-09T22:28:07+00:00

How to begin a storyboard when a property binding changed ? The source of

  • 0

How to begin a storyboard when a property binding changed ?

The source of my image change every 5s (in my ViewModel), and I want play a storyboard when the image is changing.

<Grid>
   <Image x:Name="image" Source="{Binding CurrentImage}"/>       
</Grid>
  • 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-09T22:28:08+00:00Added an answer on June 9, 2026 at 10:28 pm

    You would typically add an EventTrigger for an event that gets fired whenever the Source property changes. Unfortunately the Image control does not define such an event, so you would have to create your own by deriving from Image:

    public class MyImage : Image
    {
        public static readonly RoutedEvent SourceChangedEvent = EventManager.RegisterRoutedEvent(
            "SourceChanged", RoutingStrategy.Direct, typeof(RoutedEventHandler), typeof(MyImage));
    
        static MyImage()
        {
            Image.SourceProperty.OverrideMetadata(typeof(MyImage), new FrameworkPropertyMetadata(SourcePropertyChanged));
        }
    
        public event RoutedEventHandler SourceChanged
        {
            add { AddHandler(SourceChangedEvent, value); }
            remove { RemoveHandler(SourceChangedEvent, value); }
        }
    
        private static void SourcePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            Image image = obj as Image;
            if (image != null)
            {
                image.RaiseEvent(new RoutedEventArgs(SourceChangedEvent));
            }
        }
    }
    

    Now you could use the SourceChanged event in an EventTrigger:

    <local:MyImage Source="{Binding Image}">
        <local:MyImage.Triggers>
            <EventTrigger RoutedEvent="local:MyImage.SourceChanged">
                <BeginStoryboard>
                    <Storyboard>
                        ...
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </local:MyImage.Triggers>
    </local:MyImage>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a slider named tbMaster : <Slider Name=tbMaster Maximum=10000 Value={Binding SbVolumeValue}/> code behind
So I was trying to make a button that will change image when mouse
I have two DataTriggers binded to a property (Side) but only one storyboard could
I have a storyboard(1) that does some basic animations in 2 seconds. I want
I am very new to wpf. I want to display an Image and a
I am trying to use MediaTimeline and DoubleAnimation inside Storyboard to play audio with
Below is a section of my customized Expander template: <Grid x:Name=ExpandSiteContainer Visibility=Visible HorizontalAlignment={TemplateBinding HorizontalContentAlignment}
I got my animation to work triggered by a property in my ViewModel. If
I want to replace WPF Storyboard with some custom WHILE loop to check if
<Canvas> <Button Name=b1 Content=Button/> <Rectangle Name=Mr1 Fill=Black> <Rectangle.Triggers> <EventTrigger SourceName=b1 RoutedEvent=Button.Click> <BeginStoryboard> <code.../> </BeginStoryboard>

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.