PropertyStatus CanWrite issue

PropertyStatus CanWrite issue

Old forum URL:

Turntwo posted on Saturday, May 14, 2011

Ran into an issue with PropertyStatus and the CanWrite property today, and wasn't able to figure out what was happening.

The issue is that a WPF Window is opened with a default BusinessObject using CslaDataProvider.  Then the key value is updated (Property of the Window), which changes the factory parameter on the CslaDataProvider causing a new Business Object to be retrieved.  When setting a property on the BO, CanWriteProperty returns false, however when PropertyStatus calls CanWriteProperty is returns True, because the PS is still attached to the old object (debug shows the CanWriteProperty call is occurring on the default BO) - even though this call is occurring after the call from the setter.  

I debugged the PropertyStatus control, and it appears that the Source is being reset properly with the new DataContext - so I don't know what the issue is.What is even weirder is that only the one property refers to the old object, the other properties don't have this problem (iarw in UpdateState is the correct object for all but this one property).

I resolved the issue by setting the DP to InitialLoad=false so the default BO doesn't get loaded (except when the dialog is used to create a new entry).  But I'm still confused as to why PS isn't associating to the new object correctly, and worried that this is causing errors elsewhere in my application (although it appears to be working elsewhere). 

Probably not enough information to resolve the issue, but if anyone has an idea I'd love to hear it. 

JonnyBee replied on Sunday, May 15, 2011


I have been working on the PropertyStatus (PS) and have a fix ready for WPF but need more testing on SL and WP.

There is several issues:

If you wish to test my updated PropertyStatus then contact me privately.
When I  have this ready for SL and WP it will be updated in the Repository.

RockfordLhotka replied on Sunday, May 15, 2011

It is also worth noting that some of this might be solved by SL5 - at least the DataContextChanged event is now supposed to be available.

Turntwo replied on Sunday, May 15, 2011

Excellent.  For now I'll stick with my workaround, but would definitely be interested in the fixes when you are complete. 

If you want me to test it in my scenario, I would be willing to do that (I can back out the workaround pretty easily).



Copyright (c) Marimer LLC