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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:16:18+00:00 2026-05-31T10:16:18+00:00

So I was trying to make a button that will change image when mouse

  • 0

So I was trying to make a button that will change image when mouse over/out/down/up….

And came up with the following:

<Image>
    <Image.Style>
        <Style TargetType="{x:Type Image}">
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="True">
                    <Setter Property="Source" Value="/MyWPF;component/Resources/MediaPlayer/Play-Normal-icon.png"/>
                </Trigger>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Source" Value="/MyWPF;component/Resources/MediaPlayer/Play-Pressed-icon.png"/>
                </Trigger>
                <Trigger Property="IsMouseOver" Value="False">
                    <Setter Property="Source" Value="/MyWPF;component/Resources/MediaPlayer/Play-Normal-icon.png"/>
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Source" Value="/MyWPF;component/Resources/MediaPlayer/Play-Disabled-icon.png"/>
                </Trigger>
                <EventTrigger RoutedEvent="MouseDown">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Source" Duration="00:00:00.5">
                                    <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                        <DiscreteObjectKeyFrame.Value>
                                            <BitmapImage UriSource="/MyWPF;component/Resources/MediaPlayer/Play-Hot-icon.png"/>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
                <EventTrigger RoutedEvent="MouseUp">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Source" Duration="00:00:00.5">
                                    <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                        <DiscreteObjectKeyFrame.Value>
                                            <BitmapImage UriSource="/MyWPF;component/Resources/MediaPlayer/Play-Normal-icon.png"/>
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Style.Triggers>
        </Style>
    </Image.Style>
</Image>

The mouse over/out works prefectly.

But once I do a mouse click (down), the EventTriggers fired, I can see the image changed.

Release the mouse click (up), the EventTriggers fired again, I can see the image changed back to the way suppose to be.

Now I mouse over/out the image. It doens’t change image anymore….

But when I do mouse down/up is still working…

So I am gussing somehow the EventTrigger overrided the IsMouseOver triggers?

Does the EventTrigger will override the other triggers?

P.S.: For those whose read my previous question, sorry I didn’t know the problem was caused because the Button got disabled from the databinding.

  • 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-05-31T10:16:19+00:00Added an answer on May 31, 2026 at 10:16 am

    This is because of dependency property value precedence, either change the other triggers to cause single frame animations or make the animations not hold their value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a Button that will play a animation-list when pressed. I
Still a newbie here, forgive me. I'm trying to make a button that will
I'm trying to make iPhone-style EditText element on android. The one that will have
I am trying to make an application that will have a set of screens
I'm trying to make a simple link that will toggle my status attribute in
I'm trying to make a form that will take given text and direct you
I'm trying to make a picture button in the compact framework. I made a
I am trying to make a form move (using the titlebar) from a button
I'm trying to make my site respond correctly to the back button. I've saved
Hey everyone. I'm trying to make a swing GUI with a button and a

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.