.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.
RelayCommand is not working in WPF app when binding is from a sub menu item.
Regression
No response
Steps to reproduce
.NET 7, WPF app, Toolkit version 8.1.0
In designer:
<MenuItem Header="MenuItem with a sub menu item">
<MenuItem Command="{Binding MyCommand}" Header="This is a sub menu item" />
</MenuItem>
<MenuItem Command="{Binding MyCommand}" Header="This is NOT a sub menu item" />
In your view model:
[RelayCommand]
public void MyCommand() {
MessageBox.Show("Hi!");
}
Expected behavior
Clicking on the sub menu item should raise MyCommand command but it does not. Clicking on the menu item which is NOT a sub menu item, the command is raised.
Describe the bug
RelayCommand is not working in WPF app when binding is from a sub menu item.
Regression
No response
Steps to reproduce
.NET 7, WPF app, Toolkit version 8.1.0
In designer:
In your view model:
Expected behavior
Clicking on the sub menu item should raise MyCommand command but it does not. Clicking on the menu item which is NOT a sub menu item, the command is raised.
Screenshots
No response
IDE and version
VS 2022 Preview
IDE version
No response
Nuget packages
Nuget package version(s)
8.1.0
Additional context
No response
Help us help you
No, just wanted to report this