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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:54:01+00:00 2026-06-03T11:54:01+00:00

The following dims the image when I disable the button and show clearly when

  • 0

The following dims the image when I disable the button and show clearly when enabled:

<Style TargetType="{x:Type Image}">
    <Style.Triggers>
      <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UIElement}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
      <Setter Property="Opacity" Value="0.25"></Setter>
    </DataTrigger>
    </Style.Triggers>
</Style>
...
<Button Name="btnPageFirst" IsEnabled="False">
    <Image Source="..\Resources\imgMoveFirst.png" />
</Button>

I want to do a similar effect but with Path. I want to gray the image. But it does not gray and there is no error.

<Style TargetType="{x:Type Path}">
    <Style.Triggers>
        <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type UIElement}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
            <Setter Property="Fill" Value="Gray"></Setter>
        </DataTrigger>
    </Style.Triggers>
</Style>
...
<Button Name="btnPageFirst" IsEnabled="False">
    <Path Data="F1M820.557,535.025L838.189,535.024 817.857,555.36 857.82,555.36 857.82,568.301 817.998,568.301 838.226,588.531 820.557,588.499 793.82,561.765 820.557,535.025z" Stretch="Uniform" Fill="DodgerBlue" Width="16" Height="16" Margin="0,0,0,0" />
</Button>

  • 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-03T11:54:08+00:00Added an answer on June 3, 2026 at 11:54 am

    There is a precedence order which is used to calculate the values of the dependency properties during runtime.

    The oversimplified precedence list:

    1. Local value (what you set on the control)
    2. Triggers
    3. Style setters

    Your problem is that you set Fill="DodgerBlue" on your path and because it has higher precedence then the Trigger that is way you don’t see the fill change. Also that is why it works for your Image because there you don’t set the Opacity directly.

    To make it work:

    1. Remove the Fill="DodgerBlue" from your path
    2. Set it in your style:

      <Style TargetType="{x:Type Path}">
          <Style.Setters>
              <Setter Property="Fill" Value="DodgerBlue"/>
          </Style.Setters>
          <Style.Triggers>
             <!-- ... -->
          </Style.Triggers>
      </Style>
      

    As a side note: if you always “inside” in a button you can rewrite the RelativeSource to:

    RelativeSource={RelativeSource AncestorType={x:Type Button}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code: template<size_t head,size_t ... Dims> struct make_vec { typedef typename make_vec<Dims...>::type
Following on from this question... how do you tell the visual studio project type
Following snippet wouldn't compile. With following error: Cannot implicitly convert type 'Container<ChildClass>' to 'Container<BaseClass>'
The Clock app has a button that dims the screen. I'd like to check
Following is a code to display a button to the toolbar. UIButton myButton =
Following is the association between 2 models: class FotoGossip < ActiveRecord::Base has_many :uploads end
Following recent hardware problems, I attempted to switch a couple of our websites to
Following the suggestions of FxCop and my personal inclination I've been encouraging the team
Following query is used for Getting Categories and one news for each category. How
Following is the script for matching regex and storing value in array: sub b1

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.