Hey,
short question:
I want to notify my ui, so my guard method is invoked once again.. But unfortunately I get an syntax-error using this statement:
NotifyOfPropertyChange(() => CanLogin);
My class inherits PropertyChangedBase.
The error message:
The type arguments for method
'void Calidburn.Miro:PropertyChangedBase.NotifyOfPropertyChange<TProperty>(Expression<Func<TProperty>>)'cannot be inferred from the usage. Try specifying the type arguments explicitly.
Do I miss some overload or is something else wrong? What else could be the problem?
Based on the code you posted in your comment, I think your problem is that the NotifyPropertyChanged method is expecting you to pass a property, rather than a method.
So you'd want something like:
public bool CanLogin
{
get
{
return !string.IsNullOrEmpty(Ip) && !string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Port);
}
}
I was going to write something about Expression<Func<TProperty>> to help explain the error message, but this answer does a fantastic job: Why would you use Expression<Func<T>> rather than Func<T>?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With