Mahapps.metro: IsEnabled does not work properly on HamburgerMenuItem

Created on 27 Jul 2018  路  5Comments  路  Source: MahApps/MahApps.Metro

Bug Description
Is not possible to enable or disable a _HamburgerMenuItem_ inside a .xaml file.
If a HamburgerMenuItem contains an _IsEnabled_ attribute, does not matter if it is True or False, binded value or not - it always shows as disabled.

To Reproduce
Based on punker76/code-samples:

  1. Open HamburgerMenuApp.V2
  2. Find a _HamburgerMenuGlyphItem_ in MainWindow.xaml
  3. Add _IsEnabled="True"_

Expected behavior
Menu item should still be enabled.

Environment(please complete the following information):
Based on punker76/code-samples:

  • OS: Win10 1803
  • VS 2017 15.7.3

Based on my own code:

  • MahApps.Metro updated
  • OS: Win10 1803
  • VS 2017 15.7.3
  • .NET Framework 4.5

Repo
Since it can be simulated on punker76/code-samples, i think it is not needed.

Additional context
Based on Issue #2865, and Pull Request #2921 it is expected to work.

Bug

Most helpful comment

@Hanebu If you use the v2.0 alpha then this property should work as expected.

All 5 comments

same here. i changed IsEnabled via C# code but if i disabled a menuitem then i cant enable it again using IsEnabled = true :(

I don't think that this is solved as I just cloned the current develop branch and the problem is still there. I'm pretty sure that the problem is caused by this line. In this void, CanExecute is set to true if the Command is null. The problem is, that on creation the Command is null but CanExecute is false which is a wrong state. I will submit a PR that changes this line to private bool canExecute = true;

Im currently stuck on that IsEnabled thing. Is there any code example of how to enable and disable a menuitem in a hamburger menu?

@Hanebu If you use the v2.0 alpha then this property should work as expected.

Awesome, I will test this right now :-) Thanks!

Was this page helpful?
0 / 5 - 0 ratings