Skip to content

NativeMenuBar broken on Windows with canExecute #10794

Open
@KarlKeu00

Description

Describe the bug
Due to an error in NativeMenuBar, all elements are taken over correctly, but the canExecute observables are not checked further in RactiveCommands.

To Reproduce
Steps to reproduce the behavior:

Create a <NativeMenu> with the following example entry: <NativeMenuItem Header="TestItem" Command="{Binding TestCommand}" /> and a <NativeMenuBar/> to show the menu bar on Windows.
The code-behind contains the following:

public ICommand TestCommand { get; }
public MainWindowViewModel() {
    TestCommand = ReactiveCommand.Create(() => { /* something*/ }, SomeOtherReactiveObject.WhenAnyValue
        .WhenValueChanged(x => x.SomeProperty)
        .Select(s => s == "someValue"));
}

Expected behavior
Actually, "TestItem" should be enabled if the condition is correct. However, the condition is only checked once.

Desktop (please complete the following information):

  • OS: Windows
  • Version 11

Additional context
I suspect it is because OnPropertyChanged() is not handled in NativeMenuBar.cs as it is in NativeMenuItem.cs.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions