MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.21k stars 2.45k forks source link

Binding on dynamicRes are not updating #4492

Open TheCamel opened 3 weeks ago

TheCamel commented 3 weeks ago

localize is not working in our app

We use strings in dictionnary and all elements are refreshed into the new strings when we change the dictionnary but not the datagrid headers (not mahapps) and the hamburger menu... Tabs are working with some other controls

Steps to reproduce

with the demo app, include the stringManager joined

and 2 dictionnaries in the folder \Resources\XAML\Languages change as resource

include one of them by default in the app.xaml

<ResourceDictionary Source="/MahApps.Metro.Demo;Component/Resources/XAML/Languages/Strings.fr-FR.xaml" />

bind a menuitem to a string in HamburgerMenuDefault.xaml

<mah:HamburgerMenuGlyphItem Glyph="/Assets/Photos/GiantSlabInOregon.png"
                            Label="{DynamicResource AdminView.LineView}" />

and bind also the tabs in HamburgerMenuSample.xaml


<TabItem Header="{DynamicResource Schedule.Auto}">
    <exampleViews:HamburgerMenuDefault DataContext="{Binding}" />
</TabItem>
<TabItem Header="{DynamicResource Schedule.Manu}">
    <exampleViews:HamburgerMenuCreatorsUpdate DataContext="{Binding}" />
</TabItem>

in the app start call to change the culture from FR to US

protected override void OnStartup(StartupEventArgs e)
{
    base.OnStartup(e);
    StringManager.Instance.SetCulture("en-US");
}

bind a command in the menu to change back

this.ShowProgressDialogCommand = new SimpleCommand<object>(o => true, x => StringManager.Instance.SetCulture("fr-FR") ); //this.RunProgressFromVm()

work in the tabs but not in the hamburger

Environment


MahApps.Metro version: all last RC
Target Core 8
TheCamel commented 3 weeks ago

StringManager.zip

file attached