RibbonTabItem doesn't inherit own dependency property

Feb 28, 2013 at 8:12 AM
Edited Feb 28, 2013 at 10:01 AM

I'm trying to do a localization for a fluent ribbon application, but I've got a problem that the TranslationProvider isn't inherited to RibbonTabItems.
public static class LocalizationScope
    public static readonly DependencyProperty TranslationProviderProperty = DependencyProperty.RegisterAttached(
        typeof (ITranslationProvider),
        new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits)

    public static void SetTranslationProvider(DependencyObject obj, ITranslationProvider value)
        obj.SetValue(TranslationProviderProperty, value);

    public static ITranslationProvider GetTranslationProvider(DependencyObject obj)
        return (ITranslationProvider)obj.GetValue(TranslationProviderProperty);
In XAML it looks like this:
<fluent:MetroWindow ... Standard namespaces ...

Here comes my dependency property!

      lex:LocalizationScope.TranslationProvider="{TranslationProvider res:Translations}">

    ... Resources ...

        <fluent:Ribbon SelectedTabIndex="{Binding SelectedRibbon, Mode=TwoWay}" IsQuickAccessToolBarVisible="False">
                <fluent:Backstage Header="{lex:Translate Options, Converter={StaticResource ToUpperConverter}}">
                        <fluent:BackstageTabItem Header="{lex:Translate Save}"/>

            <fluent:RibbonTabItem x:Name="Home" Header="{lex:Translate Home, Converter={StaticResource ToUpperConverter}}">
                    <fluent:Button LargeIcon="Images\appbar.refresh.png" Header="{lex:Translate Reload}"
                                         Command="{Binding ReloadCommand, Mode=OneWay}"/>

        <TextBlock Text="{lex:Translate Hello}" />
And in the Background basically this happens:
result = LocalizationScope.GetTranslationProvider(obj);

return result.Translate(key);
This works for all items except for RibbonTabItem and everything in this Tab.
Even obj is set to the Right RibbonTabItem but I don't get a ITranslationProvider back, because it seems that the inheritance is ignored somewhere.

In an older application with Office 2010 style this doesn't happen.

Can anyone tell me where it goes wrong?
Mar 7, 2013 at 10:18 PM
Does this only happen when using the metro theme or even when using the office 2010 theme?
Mar 14, 2013 at 12:50 PM
This does happen with both styles. I still don't know why it gets lost in the first way, but when i change the language later on it will work, so i simply set the language on startup at OnLoaded and it works.