how to refresh ribbon if CurrentUICulture changes?

Sep 1, 2009 at 12:06 AM

This may be general WPF as well as ribbon, but I'm specifically interested in the ribbon at the moment...

My app has a resource assembly that provides localized in strings in various cultures. We use resgen to build a class that provides static references to the keys as members of a class  StringResources in some namespace.  I have registered the namespace as "resx" for reference in xaml, and as such I can do this:

<r:RibbonMenuItem.Command>
    <r:RibbonCommand LabelTitle="{x:Static resx:Strings.Ribbon_Label_French}"
</r:RibbonMenuItem.Command>

and sure enough, the correct version of the string for whatever the CurrentUICulture is set to when the app starts up is displayed. Yay.

My challenge is to allow the user to change their current culture while the app is running. This I can do, and once I set the CurrentUICulture on the UI thread, sure enough everything that gets rendered from that point uses the right culture.

But, the ribbon doesn't feel the change. It just got the value for these LabelTitle strings once when it was first displayed.

How can I tell the ribbon to refresh these things?

I thought maybe I could do a data binding hack

<r:RibbonMenuItem.Command>
<r:RibbonCommand LabelTitle="{Binding Path=Ribbon_Label_French}"
</r:RibbonMenuItem.Command>


But I get an error because LabelTitle is not a DependencyProperty. That approach would have been pretty cumbersome anyway.

Is there any way to do this?
What if it weren't a ribbon thing, but just a plain old WPF label, where I had set the content property in this way?
I think it is the same problem.

Thanks
roger