This project has moved and is read-only. For the latest updates, please go here.

Problem with Property Export

Dec 16, 2009 at 11:15 AM
Edited Dec 16, 2009 at 11:17 AM

Hi all,

I've used recently SL4 and its built-in MEF. I exported one Property that contains one Control (UserControl) and I tried to import this property in the other class.

By debugging I got this kind of implementation worked well. The imported class received the correct instance of exported property.

However, if I changed this imported Control (by changing its properties), those changes were not appeared. But when I did not use MEF and used normal way - referent object passing instead, it worked perfectly.

Could you all explain me the reason behind? Thank you so much!



Dec 18, 2009 at 1:45 PM

Could any one help me :) ?



Dec 18, 2009 at 3:52 PM

Property exports are evaluated once at the time of import (i.e. the import is a local copy of the exported property's value at the time of import; it is not a reference). Subsequent changes to the value of the property are not propagated to the importer. If you want to import a value that will change over time, export a method instead. Each time the method importer calls the method, it will recieve the current value of the underlying "property".


Dec 21, 2009 at 8:39 AM

Yes, you're right. Thank you for your help Ron!