Could PropertyStatus be altered to allow hiding of the target control easily?

Could PropertyStatus be altered to allow hiding of the target control easily?

Old forum URL: forums.lhotka.net/forums/t/9445.aspx


skagen00 posted on Friday, August 27, 2010

 i.e. in HandleTarget(), would it be possible to have a property on PropertyStatus that might actually hide the target control in the event of CanRead being false rather than simply clearing out the value? 

.i.e. when if (TargetControl != null  && !CanRead)

MethodCaller.CallMethodIfImplemented(TargetControl, "set_Visibility", Visibility.Collapsed);

I tried to figure out a way to inject this behavior without doing an outright copy of the control, including handling OnPropertyChanged of CanRead in a descendent of PropertyStatus, but the first time around within CanRead it appears that TargetControl is null - so the second time CanRead is set to false below, the CanRead doesn't actually invoke OnPropertyChanged.

 

RockfordLhotka replied on Saturday, August 28, 2010

The whole idea of PropertyStatus altering the UI control has been removed. That was a dead-end, because everyone wants it to work differently, and it was really not in the spirit of XAML.

PropertyStatus exposes a set of properties, such as CanRead. You can bind your UI control to the PropertyStatus control (usually with a value converter) to alter the properties of the UI control (or its container) to make it visible or not, change its color - whatever you'd like to do.

These properties exist in 3.8 and higher, and in CSLA 4 the idea of controlling the UI control is completely gone.

Copyright (c) Marimer LLC