This question already has an answer here:
- Converter with Dependency Properties 2 answers
Extending the following question:
Defining a Property in a IValueConverter class
My question is:
In the xaml file, TrueValue is set to a single value:
<CheckBox IsChecked="{Binding item, Converter={converter:ValueConverterWithProperties TrueValue=5}}"></CheckBox>
Is it possible to bind a property in a ValueConverter to some kind of List? How would the binding expression look like?
You can declare a dependency property in the converter class, declare your converter as static resource and bind the property to a view model property.
This will work:
The converter:
Binding to parameters or properties of
IValueConverter
does not work AFAIK, but you can use aIMultiValueConverter
and just bind the additional values to the desired property:and then use
values[0]
as the actual value andvalues[1]
as the parameter.