I want to bind a button's IsEnabled to the result of a boolean expression.
I only find quite complex solutions using converters or other methods. Is it also possible in a more simple way?
Example code:
<Button IsEnabled="{ Binding Path=IsRecordingEnabled }" />
public partial class MainWindow : Window
{
public bool IsRecording { get; set; } = false;
public string LoggingFolder { get; set; } = null;
public bool IsRecordingEnabled
{
get
{
return !IsRecording && LoggingFolder != null;
}
}
// ...
}
Obviously the Button is not updating when the expression changes. I understand that I need to notify the GUI via OnNotifyPropertyChanged or similar. But how to do that in my case where I want to handle the boolean expression which has no set method but is changed via the composition of IsRecording and LoggingFolder.