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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:32:13+00:00 2026-06-11T13:32:13+00:00

While reading about DataTrigger on MSDN, it says Represents a trigger that applies property

  • 0

While reading about DataTrigger on MSDN, it says

Represents a trigger that applies property values or performs actions when the bound data meets a specified condition.

It means

When a trigger is true it changes the value to the desired value.

But, can this be inferred?

When it is no longer true it returns the value to the previous value.


How I came to this conclusion

I did this

<Style x:Key="fd" TargetType="SomeControl">
 <Setter Property="Control.Template">
  <Setter.Value>
   <ControlTemplate>
    <Button Content="Foo" x:Name="mybutton">
    <ControlTemplate.Triggers>
     <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=FooProperty}" 
                  Value="Collapsed">
      <Setter Property="IsEnabled" Value="False" TargetName="mybutton"/>
      <Setter Property="Opacity" Value="0.5" TargetName="mybutton"/>
     </DataTrigger>
    </ControlTemplate.Triggers>
   </ControlTemplate>
  </Setter.Value>
 </Setter>
</Style>

When FooProperty becomes collapsed it changes mybutton’s IsEnabled to False and Opacity to 0.5

Now when FooProperty becomes visible it changes mybutton’s IsEnabled to True and Opacity to 1 even though I have not written any trigger for reverting back to previous values.

Is this an inbuilt feature of DataTrigger to revert back to previous value When it is no longer true?

If yes, is there any Microsoft/MSDN doc to prove this?

  • 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-11T13:32:13+00:00Added an answer on June 11, 2026 at 1:32 pm

    What you are telling, is correct.

    As for actual doc to prove this,
    search from here:

    http://msdn.microsoft.com/en-us/library/ms745683.aspx

    http://msdn.microsoft.com/en-us/library/system.windows.trigger.aspx

    “Remarks section”

    WPF defines properties that correspond to end-user actions, such as
    the IsMouseOver property that is set to true when the user hovers the
    cursor over a UIElement or the corresponding IsMouseOver property of a
    ContentElement. Representing end-user actions in property values,
    along with the Trigger element, allows WPF styles to change property
    values based on those end-user actions, all from within markup.

    The properties changed by triggers are automatically reset to their
    previous value when the triggered condition is no longer satisfied.
    Triggers are optimized for transient states which are expected to
    change and return to original state, such as IsPressed on Button and
    IsSelected on ListBoxItem. The Property of interest must be a
    dependency property.

    Note that you must specify both the Property and Value properties on a
    Trigger for the trigger to be meaningful. If one or both of the
    properties are not set, an exception is thrown.

    good luck 🙂

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

Sidebar

Related Questions

While I was reading about session hijacking articles, i learned that it would be
While reading about tuning SQL queries, I read somewhere that 'Always use table alias
While reading about Program counter i came to know to that The Program Counter
While reading about memmove I read that it can handle MEMORY OVERLAPS but I
While reading about printf(),I found that it can print numbers as positive or negative
While reading about the function InterlockedIncrement I saw the remark that the variable passed
While reading about Java I/O, i realized that there are two ways through which
While I was reading about System V IPC, I found that they can not
I have written a small program, while reading a book about swing, that creates
While reading about exception, I will always come across checked exceptions and unchecked exceptions,

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.