Sep 4, 2008 at 9:15 PM

I am searching for a flexible localization possibility and found one from Sacha Barber (using satelite resource DLLs in WPF).

It basically binds labels to assembly items using a DynamicResource like this 











<ResourceDictionary Source="Dictionary_en-US.xaml" />











in Xaml (for a textblock text)


<TextBlock Text="{DynamicResource label1}"





The resource looks like this


ResourceDictionary xmlns=""









<system:String x:Key="label1">en-us label1</system:String>



<system:String x:Key="label2">en-us label2</system:String>...


The column headers are bound the same way 




<dg:DataGridTextColumn Header="{DynamicResource label1}" DataFieldBinding="{Binding Path=ModuleName}" />


When starting the application all seems well, both the TextBlock and the column header get the label from the initial ressource.

But after switching the assembly the labels will only be refreshed for the TextBlock, although the resource entry is the same for both

 The switch is done using this routine:


Public Sub ApplyCultureDictionary(ByVal cultureDictionaryUri As Uri)



' Load the ResourceDictionary into memory.



Dim cultureDict As ResourceDictionary = TryCast(Application.LoadComponent(cultureDictionaryUri), ResourceDictionary)



Dim mergedDicts As Collection(Of ResourceDictionary) = MyBase.Resources.MergedDictionaries



' Remove the existing skin dictionary, if one exists.



' NOTE: In a real application, this logic might need



' to be more complex, because there might be dictionaries



' which should not be removed.



If mergedDicts.Count > 0 Then




End If



' Apply the selected skin so that all elements in the



' application will honor the new look and feel.




End Sub


 Unfortunately, this does not work for the Header-Property 

Am I completely wrong here?

Sep 4, 2008 at 9:34 PM

I missed one detail:

In Sachas solution, there was a problem that controls (a button) build at runtime won't get refreshed.
This may be the same here.

The following helped for the button

Button dynbtn = new Button();
dynbtn.SetResourceReference(Button.ContentProperty, “label1″);

Maybe there is one such line for the gridcols, too?