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 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

Related Questions

The WPF Grid has an IsMouseOver property that you can use in the Grid's
Can I use a trigger on the SelectedItem property in any control that supports
You can use the Filter property of a BindingSource to do SQL like filtering.
Can someone provide a simple example of how to properly use Html.RadioButtonFor? Let's say
You can use a standard dot notation or a method call in Objective-C to
You can use App.config; but it only supports key/value pairs. You can use .Net
I can use VS08's MFC/ActiveX template to create a C++ ActiveX object that I
I want to be able to have a generic style template that can switch
i have button with this style: <Style TargetType=Button x:Key=btnStyle> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType=Button>
I searched and find out I can't set the tooltip in setter.value directly (in

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.