Hi All,
I'm trying to have IsDirty equal to false even if some readonly properties have been changed. The user is not actually changing these values, it's a background process that does the job
Thanks.
Jonathan.
Generally, If you do not want the object to be dirty then it is the responsibility of the object to do this. What I mean is, an external process should not modify a property of the BO without the BO becoming dirty... unless that is the intent of the property (in which case the property setter should use LoadProperty instead of SetProperty).
That being said, there are two mechanisms for changing properties without IsDirty being set to true: BypassPropertyChecks and LoadProperty
public class SomeEntity : BusinessBase<SomeEntity>
{
public void SomeMethodToBeCalledByAnotherEntity()
{
//using BypassPropertyCheck
using(BypassPropertyChecks)
{
this.SomeProperty = "some value";
}
//using LoadProperty
LoadProperty(SomePropertyProperty, "some value");
}
}
That's what I did first. Using LoadProperty works pretty well BUT my UI is not being refreshed if I use this.
I have set the update mode of my controls to OnPropertyChanged. Is there a way to force my UI to rebind those properties even if the PropertyChanged event has not been raised?
Thanks for your reply.
Jonathan.
Hi,
Call method OnPropertyChanged(propertyName) i your property setter to notify UI that the property has changed.
OnPropertyChanged will not mark the object as dirty and trigger validation rules as PropertyhasChanged does.
Many Thanks JonnyBee!
You rock!
Jonathan.
Copyright (c) Marimer LLC