I've been playing with the Caliburn Micro MVVM framework and am having some problems with guard methods.
I have a view model:
public class MyViewModel : PropertyChangedBase, IMyViewModel
A property:
public DateTime? Date
{
get{return this.date; }
set
{
this.date = value;
this.NotifyOfPropertyChange(() => Date);
}
}
Also, i have a method in my view model with a guard method
public void Calculate()
{
// ..some code..
}
public bool CanCalculate()
{
return this.Date.HasValue;
}
And a button in my view:
The problem I am having is that the CanCalculate method executes when loading but when I enter values into the text fields, it doesn't reevaluate the CanCalculate method. I am firing the property changed event on setting the databound view model properties so what could be the problem?