WPF – Spell checking

I investigates last week to add spellchecking on the localize view of CBR to help us in translation…A quick search on internet tells me that, with net 4, I need the language packs (fr+en+de). Note that it’s not the same with NET3.5.

To download them : http://www.microsoft.com/en-us/download/details.aspx?id=3324

Then I had to bind my text boxes to the current language I already had in my view model as string…

<TextBox Text=”{Binding Path=Translated}” HorizontalAlignment=”Stretch” SpellCheck.IsEnabled=”True” Language=”{Binding DataContext.ActualCode, RelativeSource={RelativeSource AncestorType=ListView}}”

PAF ! Exception !

Binding for property ‘Language’ cannot use the target element’s Language for conversion; if a culture is required, ConverterCulture must be explicitly specified on the Binding.

A second and more longer search brings me to the fact that “Language” property in xaml require a special converter that need also a special “parameter”

The solution is : Add the namespace


Language=”{Binding DataContext.ActualCode, RelativeSource={RelativeSource AncestorType=ListView}, ConverterCulture={x:Static glob:CultureInfo.InvariantCulture}}”