Hi All
I think this is probably quite easy but I can't get the syntax right. I have a button and it's enabled property depends on two states in the ViewModel. 1. That an Algorithm has been loaded and 2. That Model Runs exist.
From the accepted answer to this post on SO, I believe I can use a MultiBinding with a Converter to flip to multiple conditions into a single boolean. Looks good.
The problem I'm facing is that all examples I'm seeing for this use bindings to a boolean properties of elements in the view. E.g.:-
xaml Code:
<MultiBinding Converter="{StaticResource booleanAndConverter}">
<Binding ElementName="SomeCheckBox" Path="IsChecked" />
<Binding ElementName="AnotherCheckbox" Path="IsChecked" />
</MultiBinding>
In my case I need to bind to two non boolean states on the view model, each with a converter that converts it to a bool.
E.g. I have another button that is enabled based on the first of the conditions (that an algorithm is loaded) for which the IsEnabled binding looks like this:-
xaml Code:
IsEnabled="{Binding AnalysisConfiguration.AlgorithmConfiguration, Converter={StaticResource NotNullNullToTrueFalseConverter}}"
So my full multi binding should look something like:-
xaml Code:
<Button.IsEnabled>
<MultiBinding Converter="{StaticResource BooleanAndConverter}">
<Binding AnalysisConfiguration.AlgorithmConfiguration, Converter={StaticResource NotNullNullToTrueFalseConverter} />
<Binding ModelRuns.Count, Converter={StaticResource GreaterThanZeroToBooleanConverter />
</MultiBinding>
</Button.IsEnabled>
I've tried various ways of phrasing this but they're all giving me syntax errors.