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

  • Home
  • SEARCH
  • 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 255287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:55:05+00:00 2026-05-11T21:55:05+00:00

How can I use a property trigger in a style (or another method) to

  • 0

How can I use a property trigger in a style (or another method) to change a property (ToolTip for example) that already has its value defined by a binding?

I have a simple button like so:

<Button Name="Button1" Style="{StaticResource ButtonStyle}" 
        ToolTip="{Binding Name}" >My Button</Button>

It has a binding on the tooltip to show the Name property of the class set as DataContext.

My problem is I want to show the Name when the button is enabled, but something else when it is disabled. I thought I could get around my problem with a style and a trigger like so:

<Style TargetType="Button" x:Key="ButtonStyle">
    <Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
    <Style.Triggers>
        <Trigger Property="IsEnabled" Value="false">
            <Setter Property="ToolTip" Value="Disabled" />
        </Trigger>
    </Style.Triggers>
</Style>

But this doesn’t work. If I removed the tooltip binding from the button then I do get the correct tooltip when the button is disabled. But it seems I can’t have both a binding and a trigger on the same property.

I could get around it by adding another trigger like so:

<Trigger Property="IsEnabled" Value="true">
    <Setter Property="ToolTip" Value="{Binding Name}" />
</Trigger>

But I would like to use the style for 4 or 5 buttons that will all have different bindings for the enabled ToolTip, but the same (fixed) tooltip when they are disabled.

Any suggestions?

  • 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-11T21:55:05+00:00Added an answer on May 11, 2026 at 9:55 pm

    The easiest solution to your problem is to create a button style that all of your buttons can use (_DisabledButtonToolTipStyle in the example below) and then define a unique style for each button that applies the enabled tool tip value. If the individual buttons always have a different tool tip value then I’d recommended simply embedding the style like below; however, if you wanted to reuse the enabled tool tip style you could easily define it in your resources and give it a key.

    <Window.Resources>
        <Style x:Key="_DisabledButtonToolTipStyle" TargetType="Button">
            <Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="false">
                    <Setter Property="ToolTip" Value="Disabled" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    
    <Grid>
        <Button Name="Button1" Content="My Button">
            <Button.Style>
                <Style TargetType="Button" BasedOn="{StaticResource _DisabledButtonToolTipStyle}">
                    <Setter Property="ToolTip" Value="{Binding Name}" />
                </Style>
            </Button.Style>
        </Button>
    </Grid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 142k
  • Answers 142k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer public Date dateTime(Date date, Date time) { return new Date(… May 12, 2026 at 8:13 am
  • Editorial Team
    Editorial Team added an answer The best-looking rounded corners are always going to be those… May 12, 2026 at 8:13 am
  • Editorial Team
    Editorial Team added an answer If your code crashes (I assume you get a sigsegv),… May 12, 2026 at 8:13 am

Related Questions

I was trying out attached properties and style triggers hoping to learn more about
I've created the following very simple button style: <ControlTemplate x:Key=SimpleButton TargetType={x:Type ButtonBase}> <ContentPresenter x:Name=content
I've got two controls, a TextBlock and a PopUp. When the user clicks (MouseDown)
I have a C# webbrowser that holds an html page that has several iframes.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.