peter
peter

Reputation: 2103

Use converter without path

How can I use a converter without a binding path? I've got some radio buttons and would like to have a converter that is passed a string and that then returns whether or not a checkbox is checked:

<RadioButton IsChecked="{Binding Converter={StaticResource LanguageToBoolConverter}, ConverterParameter='de_DE'}" Command="{Binding ChangeLanguageCommand, ElementName=LangSelector}" CommandParameter="de-DE">

However, I get the error message Two-way binding requires Path or XPath.

Upvotes: 0

Views: 266

Answers (1)

dkozl
dkozl

Reputation: 33364

In such case you need to specify path to current DataContext

IsChecked="{Binding Path=., Converter={StaticResource LanguageToBoolConverter}, ..."

From MSDN:

Optionally, a period (.) path can be used to bind to the current source. For example, Text="{Binding}" is equivalent to Text="{Binding Path=.}".

Upvotes: 1

Related Questions