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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:11:24+00:00 2026-06-09T21:11:24+00:00

I use Styles to define what happens when a user hovers over an image

  • 0

I use Styles to define what happens when a user hovers over an image like this.

<Style TargetType="{x:Type Image}">
    <Setter Property="Source" Value="c:\\2.bmp"/>
    <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Source" Value="C:\\1.bmp"/>
        </Trigger>
    </Style.Triggers>
</Style>

But, I guess for all the images that I include in my application, the same images defined in ‘Value’ attributes are used. What If I need a different on-hover image for different Images without this custom overriding?

In this case, any ideas what I should use? Or what is the better way to handle hovering of images in WPF?

  • 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-09T21:11:26+00:00Added an answer on June 9, 2026 at 9:11 pm

    You can define several different styles and give them an x:Key value, rather than a TargetType value. You can then simply set the Style attribute of your images to the x:Key of the appropriate style.

    If you want to apply a single style to the majority of your Images, but you want to override it for just a few of them, then you can combine the two methods. If you assign a style to a type of element (via the TargetType attribute), you can override this on specific elements by explicitly specifying their Style attribute. Also, if you set Style={x:Null}, you can make an element revert to the default style.

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

Sidebar

Related Questions

I define a style in app.xaml: <Style x:Key=textBoxCenter TargetType={x:Type TextBox}> <Setter Property=VerticalContentAlignment Value=Center/> <Setter
I have defined 3 styles in ResourceDictionary in external assembly like this: <Style x:Key={ComponentResourceKey
I want to define control styles in a resource dictionary and use those for
I'm writing styles for a page where I'd like to use rgba colors on
If i use MergedDictionaries multiple times to define styles, it doesn't work at runtime,
I would like to use javascript to style an element to look like a
I use config.ContentsCss to load the live site's styles into the editor: config.contentsCss =
I use ClientBundle and CssResource interfaces. All styles, that applies as class are work:
Does anyone know the syntax to use to add pattern styles to the cell
I am trying to use style to affect the spacing of cells in my

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.