Posted 14 years ago
by pgenfer
Hi,
I have the following issue:
I implemented a CachedPropertyDataAccessorBase to do some special handling in the AddChild and RemoveChild methods. For this reason I've overriden the CanRemove property like this:Note: "Property" is just a internal data structure I use.
The problem is, if the first call to "CanRemove" returns true, everything works fine, I can press the "Delete" button and the "RemoveChild" method will be called, after that, the "Delete" button is grayed out until I set the Property.Value again.
But if the first call of "CanRemove" returns false, the "Delete" button will never be visible, no matter if a later call of "CanRemove" will return true. So it seems to me that the "Remove" button visible state is only validated after the first call, if this returns false the button will never be visible again, no matter what is returned by the CanRemove method.
Is there anything I can do to change this behavior or am I doing something wrong with my implementation of the DataAcccessor?
Any help from your side would be appreciated,
Thank you,
Patric
I have the following issue:
I implemented a CachedPropertyDataAccessorBase to do some special handling in the AddChild and RemoveChild methods. For this reason I've overriden the CanRemove property like this:
public override bool CanRemove
{
get
{
// if internal property can be edited and has a value,
// enable the user to remove this value
return !Property.ReadOnly && Property.Value != null;
}
}
The problem is, if the first call to "CanRemove" returns true, everything works fine, I can press the "Delete" button and the "RemoveChild" method will be called, after that, the "Delete" button is grayed out until I set the Property.Value again.
But if the first call of "CanRemove" returns false, the "Delete" button will never be visible, no matter if a later call of "CanRemove" will return true. So it seems to me that the "Remove" button visible state is only validated after the first call, if this returns false the button will never be visible again, no matter what is returned by the CanRemove method.
Is there anything I can do to change this behavior or am I doing something wrong with my implementation of the DataAcccessor?
Any help from your side would be appreciated,
Thank you,
Patric