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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:31:43+00:00 2026-05-22T01:31:43+00:00

I am attempting to implement a WPF ViewModel using Castle Windsor Dynamic Proxies. The

  • 0

I am attempting to implement a WPF ViewModel using Castle Windsor Dynamic Proxies. The idea is that I want to supply an interface (IPerson below should suffice as an example), a concrete backing class, and an interceptor (for providing automatic implementation of INotifyPropertyChanged). The interceptor implementation is here: http://www.hightech.ir/SeeSharp/Best-Implementation-Of-INotifyPropertyChange-Ever

The problem that I am seeing is that when I bind my models to WPF controls, the controls don’t see the models as implementing INotifyPropertyChanged. I believe (but am not sure) that this is because Windsor is implementing the interfaces explicitly, and WPF seems to expect them to be implicit.

Is there any way to make this work, so that changes to the model are caught by the interceptor and raised to the model?

All versions of the libraries are the latest: Castle.Core 2.5.1.0 and Windsor 2.5.1.0

Code is as follows:

// My model's interface
public interface IPerson : INotifyPropertyChanged
{
    string First { get; set; }
    string LastName { get; set; }
    DateTime Birthdate { get; set; }
}

// My concrete class:
[Interceptor(typeof(NotifyPropertyChangedInterceptor))]
class Person : IPerson
{
    public event PropertyChangedEventHandler PropertyChanged = (s,e)=> { };
    public string First { get; set; }
    public string LastName { get; set; }
    public DateTime Birthdate { get; set; }
}

// My windsor installer
public class Installer : IWindsorInstaller
{
    public void Install(IWindsorContainer container, IConfigurationStore store)
    {
        container.Register(
            Component.For<NotifyPropertyChangedInterceptor>()
            .ImplementedBy<NotifyPropertyChangedInterceptor>()
            .LifeStyle.Transient);
        container.Register(
            Component.For<IPerson, INotifyPropertyChanged>()
            .ImplementedBy<Person>().LifeStyle.Transient);
    }
}
  • 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-22T01:31:44+00:00Added an answer on May 22, 2026 at 1:31 am

    So the answer turned out to be fairly straightforward… The code from http://www.hightech.ir/SeeSharp/Best-Implementation-Of-INotifyPropertyChange-Ever defines the interceptor as:

    public class NotifyPropertyChangedInterceptor : IInterceptor
    {
        private PropertyChangedEventHandler _subscribers = delegate { };
    
        public void Intercept(IInvocation invocation)
        {
            if (invocation.Method.DeclaringType == typeof(INotifyPropertyChanged))
            {
                HandleSubscription(invocation);
                return;
            }
    
            invocation.Proceed();
    
            if (invocation.Method.Name.StartsWith("set_"))
            {
                FireNotificationChanged(invocation);
            }
        }
    
        private void HandleSubscription(IInvocation invocation)
        {
            var handler = (PropertyChangedEventHandler)invocation.Arguments[0];
    
            if (invocation.Method.Name.StartsWith("add_"))
            {
                _subscribers += handler;
            }
            else
            {
                _subscribers -= handler;
            }
        }
    
        private void FireNotificationChanged(IInvocation invocation)
        {
            var propertyName = invocation.Method.Name.Substring(4);
            _subscribers(invocation.InvocationTarget, new PropertyChangedEventArgs(propertyName));
        }
    }
    

    In my case, the InvocationTarget was simply not the right entity to be passing as the first argument to PropertyChanged (because I am generating a proxy). Changing the last function to the following fixed the problem:

    private void FireNotificationChanged(IInvocation invocation)
    {
        var propertyName = invocation.Method.Name.Substring(4);
        _subscribers(invocation.Proxy, new PropertyChangedEventArgs(propertyName));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web form that I am attempting to implement dynamic drop down
In attempting to implement fileUpload using the streaming API I get an error described
I'm attempting to implement a progress bar with a textbox on top that also
Attempting to print out a list of values from 2 different variables that are
I am writing (attempting to write) unit tests for a WPF application. The business
I am attempting to display the results of a query in a WPF datagrid.
Attempting to implement a poor man's test of whether a process is still running
Is anyone attempting to implement C# for the JVM? As a Java developer, I've
We're currently attempting to implement a sql server 2008 udf to do expansion of
I am attempting to implement global error handling in my MVC application. I have

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.