Force update notifications for DependencyProperty even when it doesn't change


I have a custom WPF control. It has a typical DependencyProperty, let's call it Status, which is updated periodically via binding. (More specifically, it is bound to a property which sends notifications according to INotifyPropertyChanged).

I want to implement a certain 'expiration' behaviour: if Status is not updated for a certain time, something happens. Ideally, this logics should be within my custom control (I have many instances of it). I set up a DispatcherTimer in the Status change handler and do what I need. All fine.

The problem is, usually, Status is updated to the same value, i.e. doesn't actually change. Yet even in this case it should reset the expiration timer.

Even if I force my view model (that implements INotifyPropertyChanged) to send the notifications on assignment regardless of whether the value changed, the WPF DependencyProperty implementation is smart enough to check for the change on its own, and it doesn't call my PropertyChangeCallback that I registered for Status (in FrameworkPropertyMetadata).

What is the best thing to do?

I could create another DependencyProperty in my control that I would always change upon assignment to Status (say, assign a random number or flip a bool), and do my timer handling there. But this seems to be an ugly and very roundabout way, especially to use.


Just to answer my own question and provide at least some solution, in the end I did what @Janne suggested. I made a wrapper class over int, so each assignment created a new object and was treated as such. (I did not override the Equals method to do numerical comparison of the Status, so the DP could only use object identity check).

As a downside, this must create a lot of small garbage (there are 100+ real-time assignments per second over the whole life of the app), but this wasn't problematic; esp. given that WPF boxes everything anyway.


  • How to buffer MongoDB inserts during disconnect in node.js?
  • How do I click on a Cell of a DataGridView programmatically?
  • Best way to send continuous data in Java using Netty
  • Full Height Image
  • Does OAuth “state” mitigate any genuinely dangerous attacks?
  • import cv2 doesn't give error on command-Prompt but error on IDLE on Windows 10, Python 3.6.4
  • What's wrong with my PNG IDAT chunk?
  • Upload synthesized speech from firebase function node.js server's tmp directory
  • Cannot get Django 1.7 Migrations to detect proper changes to my DB.
  • Draw ring with given thickness, position, and radius. (Java2D)
  • Laravel 5.7: Custom blade template for Maintenance Mode but not 503.blade.php
  • Gitlab: copy project to other git lab repository
  • Admob in ListView not clickable
  • Unable to start a WebView from an AsyncTask
  • Facebook Error (#200) The user hasn't authorized the application to perform this action (PHP)
  • How to load dynamic images in custom ListView
  • How to resolve this in PHPUnit where it is asking me to set KERNEL_DIR in my phpunit.xml?
  • What is the difference between dynamically creating a script tag and statically embed a script tag?
  • time column in sqlite using gorm
  • Possible to set default CloudKit container not based on application name?
  • Tensorflow Dataset API restore Iterator after completing one epoch
  • concise way of flattening multiindex columns
  • gnuplot - How to make zmin equal to zmax keeeping autoscale on z axis
  • Change cell value based on cell color in google spreadsheet
  • Android: Unable to detect vertical plane
  • How do I add a mouse over tooltip to an Image using .DrawImage()
  • Spring Boot fails to start
  • Bind selectedDates Aggregation for Calendar
  • Debug `Unexpected end of JSON input Error` on content script
  • Apple Mach-O Linker error (“duplicate symbol”)
  • Call Microservice from another Microservice within Docker
  • Angular FormGroup won't update it's value immediately after patchValue or setValue
  • How to mutate multiple variables without repeating codes?