lepoco / lepoco/wpfui

IsEnabled Binding on MenuItem not working if Command is bound

Open
#1,387 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
9.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

I have a MenuItem.IsEnabled bound to a observable property with a NullToBoolConverter.
With breakpoints in the converter I can confirm it is called on changes and returns true but the MenuItem stays disabled.

<ui:MenuItem 
    Header="Löschen" 
    Icon="{ui:SymbolIcon Symbol=Delete24}" 
    Command="{Binding ViewModel.RemoveHelperCommand}"
    IsEnabled="{Binding ViewModel.SelectedHelper, Converter={StaticResource NullToBoolConverter}, ConverterParameter='NullIsFalse', Mode=OneWay}"/>

I was able to fix it by removing the Command={Bionding binding.

To Reproduce

See description.

Expected behavior

The binding just works like without a Command binding.

Screenshots

No response

OS version

Windows 11 24H2

.NET version

.NET Framework 4.8

WPF-UI NuGet version

4.0.2

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the XAML in the issue with WPF-UI 4.0.2 on Windows 11 and compare the behavior with and without the Command binding. The work is done when MenuItem.IsEnabled follows the observable value while the Command remains bound.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.