Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding on dynamicRes are not updating #4492

Open
TheCamel opened this issue Jun 13, 2024 · 8 comments
Open

Binding on dynamicRes are not updating #4492

TheCamel opened this issue Jun 13, 2024 · 8 comments
Labels

Comments

@TheCamel
Copy link

TheCamel commented Jun 13, 2024

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 TheCamel added the Bug label Jun 13, 2024
@TheCamel
Copy link
Author

StringManager.zip

file attached

@TheCamel
Copy link
Author

@punker76
Hello Jan, we are wondering if the support for mahapps is discontinued or not because there are not so much updates on it ? as we would like to use it on production app, it is quite difficult for us to make a choice - or not. Do you need help and contribution ? If we spend time on it will it be taken in account ? Thanks in advance for your return.

@punker76
Copy link
Member

@TheCamel No no, support is not stopped. Currently not so much time, but I try to do my best. I currently invested time to solve this issue here, but I have no due date for a fix. If you want to contribute then feel free to start and create PRs. Thx Jan

@TheCamel
Copy link
Author

@punker76 , just a short word. I found out where it comes from...but i would like to understood first :-)

@TheCamel
Copy link
Author

TheCamel commented Aug 30, 2024

Hi @punker76,
I've been working on this for a few days now and I think I've come to a conclusion. Without any criticism, I think that there is a design error in the component and the use of items/template/etc...

In the WPF philosophy:
-Either you put direct items in the control with everything you need such as treeviewitems, etc...
-or you define an ItemTemplate and/or datatemplates in conjunction with an item source collection of models (not very useful for a hamburger but who knows an application could define its menu in database via models)

but here there's a mixture of the 2... it even crashes visual sutdio if I mess with the code too much. I've also noticed that the icons aren't displayed in the designer in the current version

then you wanted to do the right thing and offer menuitems with templates and styles, but that's not the role of a graphical component; look at listboxes, etc., they only display a label by default. Hamburger should handle lists, that's all, with a style container ok but no more.

I've kept the templating on the splitView because it works perfectly. However, I turned Hamburger into a Selector (ItemControl with current item management) and added the OptionList and Content properties.

ItemsSources => click or commands=>change content.
Option=>Click =>no content change, just an action.

I've removed everything else, it's much simpler.
No more special listboxes, no more items and interfaces, no more selector style. A lot less xaml and code.

I put in a demo tab and deleted the old code to make sure I didn't make a mistake and to have a mix of code.

Then if you don't want to use/integrate my proposal, there's no problem, I understand, I can integrate the new burger control directly into my app, or even make a copy of mahapps because I have other ideas.

My code is in https://github.com/TheCamel/MahApps.Metro/tree/issues_4492

I'll be waiting for you to get back to me as soon as possible to decide whether or not to PR it.

@TheCamel
Copy link
Author

TheCamel commented Oct 7, 2024

@punker76
Jan, no news from you? and my proposal? You can refuse :-) Regards

@punker76
Copy link
Member

punker76 commented Oct 7, 2024

I worked on a solution (inspired by your inspection and solution), but had no time to finish yet...

@TheCamel
Copy link
Author

@punker76
Hi, fyi the same problem exist on the MultiSelectionComboBox ; items in the textbox and the list never get translated...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants