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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:40:24+00:00 2026-05-20T06:40:24+00:00

Based on the documentation via MSDN… You can also use InvalidateProperty to force re-evaluation

  • 0

Based on the documentation via MSDN…

You can also use InvalidateProperty to
force re-evaluation of a binding
against a data source that is not able
to implement the recommended
INotifyPropertyChanged notification
mechanism…

…the code below should work, yet it doesn’t.

public partial class Window1 : Window
{
    private Payload _payload = new Payload();

    public Window1()
    {
        InitializeComponent();

        this.DataContext = _payload;
    }

    private void Invalidate(object sender, RoutedEventArgs e)
    {
        _payload.Timestamp = DateTime.Now.Add(TimeSpan.FromHours(1)).ToLongTimeString();

        Button b = sender as Button;
        b.InvalidateProperty(Button.ContentProperty);
    }
}

public class Payload
{
    private String _payload = DateTime.Now.ToLongTimeString();
    public String Timestamp 
    {
        get
        {
            return _payload;
        }
        set
        {
            _payload = value;
        }
   }
}

<Grid>
    <Button Click="Invalidate"
            Width="100" 
            Height="50" 
            Content="{Binding Path=Timestamp}"/>
</Grid>

Any idea what is causing this behavior?

  • 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-20T06:40:24+00:00Added an answer on May 20, 2026 at 6:40 am

    As you mentioned, it ought to work but doesn’t. But there is a simple workaround:

    // Doesn't work:
    //b.InvalidateProperty(Button.ContentProperty);
    
    // Works:
    BindingOperations.GetBindingExpression(b, Button.ContentProperty).UpdateTarget();
    

    I debugged into the reference source and all InvalidateProperty does in your situation is cause a cached value to be re-read from the BindingExpression into the Button Content property. Offhand, I don’t know when this would even be necessary but it’s not useful to get the BindingExpression to re-read the raw property.

    Since the workaround is convenient and general, the only further effort warranted is filing a bug report with Microsoft.

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

Sidebar

Related Questions

Based on the IE documentation on MSDN IE 8 supports up to 6 parallel
February, 26 2010 21:34:00 Based on all the documentation I can find, MMMM, d
I have an assembly containing very thorough XML-based documentation, which is used through Sandcastle
Based on documentation and articles it is recommended to call Abort() on a client
I'm using MySQL API's function mysql_real_escape_string() Based on the documentation, it escapes the following
I would like to use output caching with WCF Data Services and although there's
in my web based app, i decided to use Cherrypy 3.2 as http framework.
I would like to know how can I start a crawler based on Scrapy.
I've got an HTTP service I defined in Flash Builder, via the Data Services
The samples and documentation in question can be found here: http://static.springsource.org/spring-flex/docs/1.5.0.M1/ The reference doc

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.