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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:26:35+00:00 2026-05-24T11:26:35+00:00

I want to listen for changes to the IsEnabled property on WPF elements (so

  • 0

I want to listen for changes to the IsEnabled property on WPF elements (so that I can run some common code whenever it changes) without having to put a load of code in each window/page.

I also want to avoid any potential problems with memory leaks due to strong event listeners. I’ve come across some articles that suggest using weak event listeners etc. but that seems awfully complicated for something that seems like it should be really easy.

I don’t want to have to subclass controls in order to do this as there are several control types (and probably more in future) that I want to listen for the IsEnabled change on.

Has anyone come up with a neater way of handling 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-05-24T11:26:37+00:00Added an answer on May 24, 2026 at 11:26 am

    A neat solution to this problem would to create a custom attached property and setup a one way binding with the IsEnabled property as the source:

    <Control IsEnabled={Binding IsEnabledProperty}
             AttachedProperty={Binding RelativeSource={RelativeSource Self}, Path=IsEnabled, Mode=OneWay}"/>
    

    This allows you to handle the common functionality in the attached property’s changed handler (which could involve firing a custom routed event as IsEnabled is a regular CLR event and won’t bubble up).

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

Sidebar

Related Questions

Assume that I want to listen to a non-common port (9090 for example) 24/7
I have built an application that listen to call state changes, and I want
I want my BHO to listen to onmousedown event of some element in a
Can I listen to Alert button click between components using AsyncToken? Basically, I want
I want to design a webform that user should fill some fields. The value
In my Chrome extension, I want to listen for changes to one particular tab
I have a linked list and I just want to listen for any changes
I have an application in which I want to listen to any changes made
I want to listen to the changes of the value of the SpinnerNumberModel for
I want to listen 'bounds_changed' event when the user moves the map, changes the

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.