Dynamic proxy lock and INotifyPropertyChanged in WPF

I wrap my proxy objects with Castle DP, my objects implement INotifyPropertyChanged on their own. and raise an event when set is called.

I wrote a few unit test on the wrapper to see that the propertychanged event is fired when I manipulate entities through a proxy, and they all went through.

the problem is the real application with the screen, when I bind the screen to a property that is actually DP, the screen registered in propertychanged in a different way and it just does not work if I do not register the control inside the interceptor code

why is this behavior, what does wpf do for a property that I do not do when registering with a property?

+3
source share
3 answers

There is one important thing to keep in mind in AOP of the castle - the method Equalsdoes not work as you expected.

Take a look here: RRSL-Lite.EntityAOP . I had the same idea - to have AOP for INPC and create this library. Here is a simple example of how to use it.

+1
source

A proxy class created as an interface proxy will have explicit implementations of the interface properties, and WPF binding will not work if this does not explicitly match.

Two solutions are to change the binding paths to explicitly enable the interface:

{Binding Path=(local:IEntity.ID)} instead of just {Binding ID}

or use the virtual method proxy for your models / entities and use any methods that you intercept with the virtual ones.

0

, , Castle CreateInterfaceProxyWithTarget . INPC PropertyChanged -, , PropertyChanged sender , . - WPF, , sender -. , . , , sender -.

0

Source: https://habr.com/ru/post/1761325/


All Articles