I have a datatemplate containing an image that I want to be hidden if the the value of a property in a ViewModel is true. Can anyone tell me why the the xaml below does not
In my opinion we not need to use Triggers, with only the Binding it works well. To make binding to a property model, you can use BooleanToVisibilityConverter Is declared as follows:
And how to use it is simple, just point to the key stated above:
The property in the ViewModel:
private bool _hasError = false;
public bool HasError
{
get { return !string.IsNullOrEmpty(_messageError); }
set
{
_hasError = value;
this.NotifyOfPropertyChange(() => this.HasError);
}
}